summaryrefslogtreecommitdiffstats
path: root/lib/json.c
diff options
context:
space:
mode:
authorwhitespace / reindent <invalid@invalid.invalid>2017-07-17 14:03:14 +0200
committerwhitespace / reindent <invalid@invalid.invalid>2017-07-17 14:04:07 +0200
commitd62a17aedeb0eebdba98238874bb13d62c48dbf9 (patch)
tree3b319b1d61c8b85b4d1f06adf8b844bb8a9b5107 /lib/json.c
parent*: add indent control files (diff)
downloadfrr-d62a17aedeb0eebdba98238874bb13d62c48dbf9.tar.xz
frr-d62a17aedeb0eebdba98238874bb13d62c48dbf9.zip
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/json.c')
-rw-r--r--lib/json.c61
1 files changed, 26 insertions, 35 deletions
diff --git a/lib/json.c b/lib/json.c
index d8c97e448..40b6aadaa 100644
--- a/lib/json.c
+++ b/lib/json.c
@@ -28,70 +28,61 @@
* is the *last* keyword on the line no matter
* what.
*/
-int
-use_json (const int argc, struct cmd_token *argv[])
+int use_json(const int argc, struct cmd_token *argv[])
{
- if (argc == 0)
- return 0;
+ if (argc == 0)
+ return 0;
- if (argv[argc-1]->arg && strmatch (argv[argc-1]->text, "json"))
- return 1;
+ if (argv[argc - 1]->arg && strmatch(argv[argc - 1]->text, "json"))
+ return 1;
- return 0;
+ return 0;
}
-void
-json_object_string_add(struct json_object* obj, const char *key,
- const char *s)
+void json_object_string_add(struct json_object *obj, const char *key,
+ const char *s)
{
- json_object_object_add(obj, key, json_object_new_string(s));
+ json_object_object_add(obj, key, json_object_new_string(s));
}
-void
-json_object_int_add(struct json_object* obj, const char *key, int64_t i)
+void json_object_int_add(struct json_object *obj, const char *key, int64_t i)
{
#if defined(HAVE_JSON_C_JSON_H)
- json_object_object_add(obj, key, json_object_new_int64(i));
+ json_object_object_add(obj, key, json_object_new_int64(i));
#else
- json_object_object_add(obj, key, json_object_new_int((int)i));
+ json_object_object_add(obj, key, json_object_new_int((int)i));
#endif
}
-void
-json_object_boolean_false_add(struct json_object* obj, const char *key)
+void json_object_boolean_false_add(struct json_object *obj, const char *key)
{
- json_object_object_add(obj, key, json_object_new_boolean(0));
+ json_object_object_add(obj, key, json_object_new_boolean(0));
}
-void
-json_object_boolean_true_add(struct json_object* obj, const char *key)
+void json_object_boolean_true_add(struct json_object *obj, const char *key)
{
- json_object_object_add(obj, key, json_object_new_boolean(1));
+ json_object_object_add(obj, key, json_object_new_boolean(1));
}
-struct json_object*
-json_object_lock(struct json_object *obj)
+struct json_object *json_object_lock(struct json_object *obj)
{
- return json_object_get(obj);
+ return json_object_get(obj);
}
-void
-json_object_free(struct json_object *obj)
+void json_object_free(struct json_object *obj)
{
- json_object_put(obj);
+ json_object_put(obj);
}
#if !defined(HAVE_JSON_C_JSON_H)
-int
-json_object_object_get_ex(struct json_object *obj,
- const char *key,
- struct json_object **value)
+int json_object_object_get_ex(struct json_object *obj, const char *key,
+ struct json_object **value)
{
- *value = json_object_object_get(obj, key);
+ *value = json_object_object_get(obj, key);
- if (*value)
- return 1;
+ if (*value)
+ return 1;
- return 0;
+ return 0;
}
#endif