mirror of
https://github.com/json-c/json-c.git
synced 2026-04-04 04:49:06 +08:00
* Rename min and max so we can never clash with C or C++ std library
Ian Atha, thatha at yahoo-inc dot com git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@43 327403b1-1117-474d-bef2-5cb71233fd97
This commit is contained in:
@@ -119,7 +119,7 @@ char* strndup(const char* str, size_t n)
|
||||
{
|
||||
if(str) {
|
||||
size_t len = strlen(str);
|
||||
size_t nn = min(len,n);
|
||||
size_t nn = json_min(len,n);
|
||||
char* s = (char*)malloc(sizeof(char) * (nn + 1));
|
||||
|
||||
if(s) {
|
||||
@@ -276,7 +276,7 @@ struct json_object* json_tokener_parse_ex(struct json_tokener *tok,
|
||||
case json_tokener_state_null:
|
||||
printbuf_memappend_fast(tok->pb, &c, 1);
|
||||
if(strncasecmp(json_null_str, tok->pb->buf,
|
||||
min(tok->st_pos+1, strlen(json_null_str))) == 0) {
|
||||
json_min(tok->st_pos+1, strlen(json_null_str))) == 0) {
|
||||
if(tok->st_pos == strlen(json_null_str)) {
|
||||
current = NULL;
|
||||
saved_state = json_tokener_state_finish;
|
||||
@@ -439,7 +439,7 @@ struct json_object* json_tokener_parse_ex(struct json_tokener *tok,
|
||||
case json_tokener_state_boolean:
|
||||
printbuf_memappend_fast(tok->pb, &c, 1);
|
||||
if(strncasecmp(json_true_str, tok->pb->buf,
|
||||
min(tok->st_pos+1, strlen(json_true_str))) == 0) {
|
||||
json_min(tok->st_pos+1, strlen(json_true_str))) == 0) {
|
||||
if(tok->st_pos == strlen(json_true_str)) {
|
||||
current = json_object_new_boolean(1);
|
||||
saved_state = json_tokener_state_finish;
|
||||
@@ -447,7 +447,7 @@ struct json_object* json_tokener_parse_ex(struct json_tokener *tok,
|
||||
goto redo_char;
|
||||
}
|
||||
} else if(strncasecmp(json_false_str, tok->pb->buf,
|
||||
min(tok->st_pos+1, strlen(json_false_str))) == 0) {
|
||||
json_min(tok->st_pos+1, strlen(json_false_str))) == 0) {
|
||||
if(tok->st_pos == strlen(json_false_str)) {
|
||||
current = json_object_new_boolean(0);
|
||||
saved_state = json_tokener_state_finish;
|
||||
|
||||
Reference in New Issue
Block a user