mirror of
https://github.com/json-c/json-c.git
synced 2026-04-01 03:19:06 +08:00
clang-format the files
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "json.h"
|
||||
#include "json_tokener.h"
|
||||
@@ -68,24 +68,17 @@ int main(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int emit_object(json_object *jso, int flags,
|
||||
json_object *parent_jso,
|
||||
const char *jso_key,
|
||||
size_t *jso_index, void *userarg)
|
||||
static int emit_object(json_object *jso, int flags, json_object *parent_jso, const char *jso_key,
|
||||
size_t *jso_index, void *userarg)
|
||||
{
|
||||
printf("flags: 0x%x, key: %s, index: %ld, value: %s\n",
|
||||
flags,
|
||||
(jso_key ? jso_key : "(null)"),
|
||||
(jso_index ? (long)*jso_index : -1L),
|
||||
printf("flags: 0x%x, key: %s, index: %ld, value: %s\n", flags,
|
||||
(jso_key ? jso_key : "(null)"), (jso_index ? (long)*jso_index : -1L),
|
||||
json_object_to_json_string(jso));
|
||||
return JSON_C_VISIT_RETURN_CONTINUE;
|
||||
}
|
||||
|
||||
static int skip_arrays(json_object *jso, int flags,
|
||||
json_object *parent_jso,
|
||||
const char *jso_key,
|
||||
size_t *jso_index, void *userarg)
|
||||
static int skip_arrays(json_object *jso, int flags, json_object *parent_jso, const char *jso_key,
|
||||
size_t *jso_index, void *userarg)
|
||||
{
|
||||
(void)emit_object(jso, flags, parent_jso, jso_key, jso_index, userarg);
|
||||
if (json_object_get_type(jso) == json_type_array)
|
||||
@@ -93,10 +86,8 @@ static int skip_arrays(json_object *jso, int flags,
|
||||
return JSON_C_VISIT_RETURN_CONTINUE;
|
||||
}
|
||||
|
||||
static int pop_and_stop(json_object *jso, int flags,
|
||||
json_object *parent_jso,
|
||||
const char *jso_key,
|
||||
size_t *jso_index, void *userarg)
|
||||
static int pop_and_stop(json_object *jso, int flags, json_object *parent_jso, const char *jso_key,
|
||||
size_t *jso_index, void *userarg)
|
||||
{
|
||||
(void)emit_object(jso, flags, parent_jso, jso_key, jso_index, userarg);
|
||||
if (jso_key != NULL && strcmp(jso_key, "subobj1") == 0)
|
||||
@@ -112,10 +103,8 @@ static int pop_and_stop(json_object *jso, int flags,
|
||||
return JSON_C_VISIT_RETURN_CONTINUE;
|
||||
}
|
||||
|
||||
static int err_on_subobj2(json_object *jso, int flags,
|
||||
json_object *parent_jso,
|
||||
const char *jso_key,
|
||||
size_t *jso_index, void *userarg)
|
||||
static int err_on_subobj2(json_object *jso, int flags, json_object *parent_jso, const char *jso_key,
|
||||
size_t *jso_index, void *userarg)
|
||||
{
|
||||
(void)emit_object(jso, flags, parent_jso, jso_key, jso_index, userarg);
|
||||
if (jso_key != NULL && strcmp(jso_key, "subobj2") == 0)
|
||||
@@ -126,9 +115,7 @@ static int err_on_subobj2(json_object *jso, int flags,
|
||||
return JSON_C_VISIT_RETURN_CONTINUE;
|
||||
}
|
||||
|
||||
static int pop_array(json_object *jso, int flags,
|
||||
json_object *parent_jso,
|
||||
const char *jso_key,
|
||||
static int pop_array(json_object *jso, int flags, json_object *parent_jso, const char *jso_key,
|
||||
size_t *jso_index, void *userarg)
|
||||
{
|
||||
(void)emit_object(jso, flags, parent_jso, jso_key, jso_index, userarg);
|
||||
@@ -140,10 +127,8 @@ static int pop_array(json_object *jso, int flags,
|
||||
return JSON_C_VISIT_RETURN_CONTINUE;
|
||||
}
|
||||
|
||||
static int stop_array(json_object *jso, int flags,
|
||||
json_object *parent_jso,
|
||||
const char *jso_key,
|
||||
size_t *jso_index, void *userarg)
|
||||
static int stop_array(json_object *jso, int flags, json_object *parent_jso, const char *jso_key,
|
||||
size_t *jso_index, void *userarg)
|
||||
{
|
||||
(void)emit_object(jso, flags, parent_jso, jso_key, jso_index, userarg);
|
||||
if (jso_index != NULL && (*jso_index == 0))
|
||||
@@ -154,15 +139,11 @@ static int stop_array(json_object *jso, int flags,
|
||||
return JSON_C_VISIT_RETURN_CONTINUE;
|
||||
}
|
||||
|
||||
static int err_return(json_object *jso, int flags,
|
||||
json_object *parent_jso,
|
||||
const char *jso_key,
|
||||
size_t *jso_index, void *userarg)
|
||||
static int err_return(json_object *jso, int flags, json_object *parent_jso, const char *jso_key,
|
||||
size_t *jso_index, void *userarg)
|
||||
{
|
||||
printf("flags: 0x%x, key: %s, index: %ld, value: %s\n",
|
||||
flags,
|
||||
(jso_key ? jso_key : "(null)"),
|
||||
(jso_index ? (long)*jso_index : -1L),
|
||||
printf("flags: 0x%x, key: %s, index: %ld, value: %s\n", flags,
|
||||
(jso_key ? jso_key : "(null)"), (jso_index ? (long)*jso_index : -1L),
|
||||
json_object_to_json_string(jso));
|
||||
return 100;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user