diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2014-12-22 19:42:00 +0000 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2014-12-22 19:42:00 +0000 |
commit | 2a2a389a340561ff886d8349bb2802c99892c92d (patch) | |
tree | e3be8994c64211c9ebd5de21fc5ffcfcf26f7872 /src/include | |
parent | ba88f0d73373d4a6dedb23b07415a4dac976fbf8 (diff) | |
download | libmicrohttpd-2a2a389a340561ff886d8349bb2802c99892c92d.tar.gz libmicrohttpd-2a2a389a340561ff886d8349bb2802c99892c92d.zip |
Replace strcasecmp/strncasecmp with platform-independent macros
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/platform_interface.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/include/platform_interface.h b/src/include/platform_interface.h index f7373e7d..64b810c5 100644 --- a/src/include/platform_interface.h +++ b/src/include/platform_interface.h | |||
@@ -31,6 +31,49 @@ | |||
31 | #include "w32functions.h" | 31 | #include "w32functions.h" |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | /* ***************************** | ||
35 | General function mapping | ||
36 | *****************************/ | ||
37 | #if !defined(_WIN32) || defined(__CYGWIN__) | ||
38 | /** | ||
39 | * Check two strings case-insensitive equality | ||
40 | * @param a first string to check | ||
41 | * @param b second string to check | ||
42 | * @return boolean true if strings are equal, boolean false if strings are unequal | ||
43 | */ | ||
44 | #define MHD_str_equal_caseless_(a,b) (0==strcasecmp((a),(b))) | ||
45 | #else | ||
46 | /** | ||
47 | * Check two strings case-insensitive equality | ||
48 | * @param a first string to check | ||
49 | * @param b second string to check | ||
50 | * @return boolean true if strings are equal, boolean false if strings are unequal | ||
51 | */ | ||
52 | #define MHD_str_equal_caseless_(a,b) (0==_stricmp((a),(b))) | ||
53 | #endif | ||
54 | |||
55 | #if !defined(_WIN32) || defined(__CYGWIN__) | ||
56 | /** | ||
57 | * Check not more than n chars in two strings case-insensitive equality | ||
58 | * @param a first string to check | ||
59 | * @param b second string to check | ||
60 | * @param n maximum number of chars to check | ||
61 | * @return boolean true if strings are equal, boolean false if strings are unequal | ||
62 | */ | ||
63 | #define MHD_str_equal_caseless_n_(a,b,n) (0==strncasecmp((a),(b),(n))) | ||
64 | #else | ||
65 | /** | ||
66 | * Check not more than n chars in two strings case-insensitive equality | ||
67 | * @param a first string to check | ||
68 | * @param b second string to check | ||
69 | * @param n maximum number of chars to check | ||
70 | * @return boolean true if strings are equal, boolean false if strings are unequal | ||
71 | */ | ||
72 | #define MHD_str_equal_caseless_n_(a,b,n) (0==_strnicmp((a),(b),(n))) | ||
73 | #endif | ||
74 | |||
75 | |||
76 | |||
34 | /* MHD_socket_close_(fd) close any FDs (non-W32) / close only socket FDs (W32) */ | 77 | /* MHD_socket_close_(fd) close any FDs (non-W32) / close only socket FDs (W32) */ |
35 | #if !defined(_WIN32) || defined(__CYGWIN__) | 78 | #if !defined(_WIN32) || defined(__CYGWIN__) |
36 | #define MHD_socket_close_(fd) close((fd)) | 79 | #define MHD_socket_close_(fd) close((fd)) |