Skip to content

Commit 8c1dbd4

Browse files
committed
Merge pull request #263 from ksuarz/CDRIVER-593-strcasecmp
CDRIVER-593 strcasecmp
2 parents b9d79b4 + bc2300a commit 8c1dbd4

9 files changed

+13
-38
lines changed

src/mongoc/mongoc-cluster.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@
5656
#define MONGOC_LOG_DOMAIN "cluster"
5757

5858

59-
#ifdef _WIN32
60-
# define strcasecmp _stricmp
61-
#endif
62-
6359
#define MIN_WIRE_VERSION 0
6460
#define MAX_WIRE_VERSION 3
6561

src/mongoc/mongoc-cursor.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,13 @@
2323
#include "mongoc-log.h"
2424
#include "mongoc-opcode.h"
2525
#include "mongoc-trace.h"
26+
#include "mongoc-util-private.h"
2627

2728

2829
#undef MONGOC_LOG_DOMAIN
2930
#define MONGOC_LOG_DOMAIN "cursor"
3031

3132

32-
#ifdef _WIN32
33-
# define strcasecmp _stricmp
34-
#endif
35-
36-
3733
static const char *gSecondaryOkCommands [] = {
3834
"aggregate",
3935
"authenticate",

src/mongoc/mongoc-host-list.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@
1515
*/
1616

1717
#include "mongoc-host-list.h"
18-
19-
20-
#ifdef _WIN32
21-
# define strcasecmp _stricmp
22-
#endif
18+
#include "mongoc-util-private.h"
2319

2420
/*
2521
*--------------------------------------------------------------------------

src/mongoc/mongoc-sasl.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,13 @@
2222

2323
#include "mongoc-error.h"
2424
#include "mongoc-sasl-private.h"
25+
#include "mongoc-util-private.h"
2526

2627

2728
#ifndef SASL_CALLBACK_FN
2829
# define SASL_CALLBACK_FN(_f) ((int (*) (void))(_f))
2930
#endif
3031

31-
#if defined(_WIN32) && !defined(strcasecmp)
32-
# define strcasecmp _stricmp
33-
#endif
34-
3532
void
3633
_mongoc_sasl_set_mechanism (mongoc_sasl_t *sasl,
3734
const char *mechanism)

src/mongoc/mongoc-server-description.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "mongoc-server-description-private.h"
2121
#include "mongoc-trace.h"
2222
#include "mongoc-uri.h"
23+
#include "mongoc-util-private.h"
2324

2425
#include <stdio.h>
2526

@@ -29,11 +30,6 @@
2930
#define ALPHA 0.2
3031

3132

32-
#if defined(_WIN32) && !defined(strcasecmp)
33-
# define strcasecmp _stricmp
34-
#endif
35-
36-
3733
static uint8_t kMongocEmptyBson[] = { 5, 0, 0, 0, 0 };
3834

3935
/* Destroy allocated resources within @description, but don't free it */

src/mongoc/mongoc-ssl.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,7 @@
3434
#include "mongoc-ssl-private.h"
3535
#include "mongoc-trace.h"
3636
#include "mongoc-thread-private.h"
37-
38-
#ifdef _WIN32
39-
# define strncasecmp _strnicmp
40-
# define strcasecmp _stricmp
41-
#endif
37+
#include "mongoc-util-private.h"
4238

4339
/* TODO: we could populate these from a config or something further down the
4440
* road for providing defaults */

src/mongoc/mongoc-topology-description.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@
1919
#include "mongoc-server-description-private.h"
2020
#include "mongoc-topology-description-private.h"
2121
#include "mongoc-trace.h"
22-
23-
24-
#if defined(_WIN32) && !defined(strcasecmp)
25-
# define strcasecmp _stricmp
26-
#endif
22+
#include "mongoc-util-private.h"
2723

2824

2925
static void

src/mongoc/mongoc-uri.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,10 @@
2626
#include "mongoc-log.h"
2727
#include "mongoc-socket.h"
2828
#include "mongoc-uri-private.h"
29+
#include "mongoc-util-private.h"
2930
#include "mongoc-write-concern-private.h"
3031

3132

32-
#if defined(_WIN32) && !defined(strcasecmp)
33-
# define strcasecmp _stricmp
34-
#endif
35-
36-
3733
struct _mongoc_uri_t
3834
{
3935
char *str;

src/mongoc/mongoc-util-private.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@
3333
} \
3434
} while (0)
3535

36+
/* string comparison functions for Windows */
37+
#ifdef _WIN32
38+
# define strcasecmp _stricmp
39+
# define strncasecmp _strnicmp
40+
#endif
41+
3642
BSON_BEGIN_DECLS
3743

3844

0 commit comments

Comments
 (0)