提交 cb6445f4 编写于 作者: M Max Bruckner

reformatting: cJSON_strcasecmp

上级 526d6b13
......@@ -4,10 +4,24 @@
#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;
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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册