Add a flags parameter to all decoding functions for future needs
As of now, the parameter is unused, but may be needed in the future. I'm adding it now so that in the future both API and ABI remain backwards compatible as long as possible. This is a backwards incompatible change.
This commit is contained in:
@@ -59,7 +59,7 @@ int main(int argc, char *argv[])
|
||||
if(getenv_int("JSON_SORT_KEYS"))
|
||||
flags |= JSON_SORT_KEYS;
|
||||
|
||||
json = json_loadf(stdin, &error);
|
||||
json = json_loadf(stdin, 0, &error);
|
||||
if(!json) {
|
||||
fprintf(stderr, "%d\n%s\n", error.line, error.text);
|
||||
return 1;
|
||||
|
||||
@@ -176,7 +176,7 @@ static void test_copy_array(void)
|
||||
json_t *array, *copy;
|
||||
size_t i;
|
||||
|
||||
array = json_loads(json_array_text, NULL);
|
||||
array = json_loads(json_array_text, 0, NULL);
|
||||
if(!array)
|
||||
fail("unable to parse an array");
|
||||
|
||||
@@ -205,7 +205,7 @@ static void test_deep_copy_array(void)
|
||||
json_t *array, *copy;
|
||||
size_t i;
|
||||
|
||||
array = json_loads(json_array_text, NULL);
|
||||
array = json_loads(json_array_text, 0, NULL);
|
||||
if(!array)
|
||||
fail("unable to parse an array");
|
||||
|
||||
@@ -235,7 +235,7 @@ static void test_copy_object(void)
|
||||
json_t *object, *copy;
|
||||
void *iter;
|
||||
|
||||
object = json_loads(json_object_text, NULL);
|
||||
object = json_loads(json_object_text, 0, NULL);
|
||||
if(!object)
|
||||
fail("unable to parse an object");
|
||||
|
||||
@@ -275,7 +275,7 @@ static void test_deep_copy_object(void)
|
||||
json_t *object, *copy;
|
||||
void *iter;
|
||||
|
||||
object = json_loads(json_object_text, NULL);
|
||||
object = json_loads(json_object_text, 0, NULL);
|
||||
if(!object)
|
||||
fail("unable to parse an object");
|
||||
|
||||
|
||||
@@ -167,8 +167,8 @@ static void test_equal_complex()
|
||||
" \"array\": [\"foo\", false, null, 1.234]"
|
||||
"}";
|
||||
|
||||
value1 = json_loads(complex_json, NULL);
|
||||
value2 = json_loads(complex_json, NULL);
|
||||
value1 = json_loads(complex_json, 0, NULL);
|
||||
value2 = json_loads(complex_json, 0, NULL);
|
||||
if(!value1 || !value2)
|
||||
fail("unable to parse JSON");
|
||||
if(!json_equal(value1, value2))
|
||||
|
||||
@@ -14,7 +14,7 @@ int main()
|
||||
json_t *json;
|
||||
json_error_t error;
|
||||
|
||||
json = json_load_file("/path/to/nonexistent/file.json", &error);
|
||||
json = json_load_file("/path/to/nonexistent/file.json", 0, &error);
|
||||
if(error.line != -1)
|
||||
fail("json_load_file returned an invalid line number");
|
||||
if(strcmp(error.text, "unable to open /path/to/nonexistent/file.json: No such file or directory") != 0)
|
||||
|
||||
Reference in New Issue
Block a user