Browse Source

reformatting: cJSON_strcasecmp

pull/37/head
Max Bruckner 8 years ago
parent
commit
cb6445f47b
  1. 24
      cJSON_Utils.c

24
cJSON_Utils.c

@ -4,11 +4,25 @@
#include <stdio.h>
#include "cJSON_Utils.h"
static int cJSONUtils_strcasecmp(const char *s1,const char *s2)
static int cJSONUtils_strcasecmp(const char *s1, const char *s2)
{
if (!s1) return (s1==s2)?0:1;if (!s2) return 1;
for(; tolower(*s1) == tolower(*s2); ++s1, ++s2) if(*s1 == 0) return 0;
return tolower(*(const unsigned char *)s1) - tolower(*(const unsigned char *)s2);
if (!s1)
{
return (s1 == s2) ? 0 : 1; /* both NULL? */
}
if (!s2)
{
return 1;
}
for(; tolower(*s1) == tolower(*s2); ++s1, ++s2)
{
if(*s1 == 0)
{
return 0;
}
}
return tolower(*(const unsigned char *)s1) - tolower(*(const unsigned char *)s2);
}
/* JSON Pointer implementation: */
@ -392,4 +406,4 @@ cJSON *cJSONUtils_GenerateMergePatch(cJSON *from,cJSON *to)
}
if (!patch->child) {cJSON_Delete(patch);return 0;}
return patch;
}
}

Loading…
Cancel
Save