diff options
Diffstat (limited to 'lib/strcase.c')
-rw-r--r-- | lib/strcase.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/strcase.c b/lib/strcase.c index 807689e..a750f7b 100644 --- a/lib/strcase.c +++ b/lib/strcase.c @@ -34,7 +34,7 @@ char Curl_raw_toupper(char in) if(in >= 'a' && in <= 'z') return (char)('A' + in - 'a'); #else - switch (in) { + switch(in) { case 'a': return 'A'; case 'b': @@ -120,6 +120,16 @@ int Curl_strcasecompare(const char *first, const char *second) return (Curl_raw_toupper(*first) == Curl_raw_toupper(*second)); } +int Curl_safe_strcasecompare(const char *first, const char *second) +{ + if(first && second) + /* both pointers point to something then compare them */ + return Curl_strcasecompare(first, second); + else + /* if both pointers are NULL then treat them as equal */ + return (NULL == first && NULL == second); +} + /* * @unittest: 1301 */ |