mirror of
https://github.com/json-c/json-c.git
synced 2026-04-05 13:29:06 +08:00
* Don't use this as a variable, so we can compile with a C++ compiler
* Add casts from void* to type of assignment when using malloc
* Add #ifdef __cplusplus guards to all of the headers
* Add typedefs for json_object, json_tokener, array_list, printbuf, lh_table
Michael Clark, <michael@metaparadigm.com>
git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@33 327403b1-1117-474d-bef2-5cb71233fd97
This commit is contained in:
@@ -57,7 +57,9 @@ const char* json_tokener_errors[] = {
|
||||
|
||||
struct json_tokener* json_tokener_new(void)
|
||||
{
|
||||
struct json_tokener *tok = calloc(1, sizeof(struct json_tokener));
|
||||
struct json_tokener *tok;
|
||||
|
||||
tok = (struct json_tokener*)calloc(1, sizeof(struct json_tokener));
|
||||
tok->pb = printbuf_new();
|
||||
json_tokener_reset(tok);
|
||||
return tok;
|
||||
@@ -100,7 +102,7 @@ struct json_object* json_tokener_parse(char *str)
|
||||
tok = json_tokener_new();
|
||||
obj = json_tokener_parse_ex(tok, str, -1);
|
||||
if(tok->err != json_tokener_success)
|
||||
obj = error_ptr(-tok->err);
|
||||
obj = (struct json_object*)error_ptr(-tok->err);
|
||||
json_tokener_free(tok);
|
||||
return obj;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user