aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/json.h
diff options
context:
space:
mode:
authorEgor Tensin <egor@tensin.name>2023-12-30 23:29:43 +0100
committerEgor Tensin <egor@tensin.name>2023-12-30 23:38:25 +0100
commit2d2869ce6060f974004ef98020b38b67366166d1 (patch)
tree534dcf35770b785ed2947c27f0e9387f941a17c4 /src/json.h
parentstring: stpecpy -> string_append (diff)
downloadcimple-2d2869ce6060f974004ef98020b38b67366166d1.tar.gz
cimple-2d2869ce6060f974004ef98020b38b67366166d1.zip
json: add the lib prefix to wrapper functions
It makes it easier to audit for non-wrapped json-c usage.
Diffstat (limited to '')
-rw-r--r--src/json.h47
1 files changed, 20 insertions, 27 deletions
diff --git a/src/json.h b/src/json.h
index 2d496c1..175a41c 100644
--- a/src/json.h
+++ b/src/json.h
@@ -8,45 +8,38 @@
#ifndef __JSON_H__
#define __JSON_H__
-#include "log.h"
-
#include <json-c/json_object.h>
#include <stdint.h>
-#define json_errno(fn) \
- do { \
- log_err("JSON: %s failed\n", fn); \
- } while (0)
-
-void json_free(struct json_object *);
+void libjson_free(struct json_object *);
-const char *json_to_string(struct json_object *);
-const char *json_to_string_pretty(struct json_object *);
-struct json_object *json_from_string(const char *);
+const char *libjson_to_string(struct json_object *);
+const char *libjson_to_string_pretty(struct json_object *);
+struct json_object *libjson_from_string(const char *);
-int json_clone(const struct json_object *, const char *key, struct json_object **value);
+int libjson_clone(const struct json_object *, const char *key, struct json_object **value);
-int json_send(struct json_object *, int fd);
-struct json_object *json_recv(int fd);
+int libjson_send(struct json_object *, int fd);
+struct json_object *libjson_recv(int fd);
-int json_new_object(struct json_object **);
-int json_new_array(struct json_object **);
+int libjson_new_object(struct json_object **);
+int libjson_new_array(struct json_object **);
-int json_has(const struct json_object *, const char *key);
+int libjson_has(const struct json_object *, const char *key);
-int json_get(const struct json_object *, const char *key, struct json_object **value);
-int json_get_string(const struct json_object *, const char *key, const char **value);
-int json_get_int(const struct json_object *, const char *key, int64_t *value);
+int libjson_get(const struct json_object *, const char *key, struct json_object **value);
+int libjson_get_string(const struct json_object *, const char *key, const char **value);
+int libjson_get_int(const struct json_object *, const char *key, int64_t *value);
-int json_set(struct json_object *, const char *key, struct json_object *value);
-int json_set_string(struct json_object *, const char *key, const char *value);
-int json_set_int(struct json_object *, const char *key, int64_t value);
+int libjson_set(struct json_object *, const char *key, struct json_object *value);
+int libjson_set_string(struct json_object *, const char *key, const char *value);
+int libjson_set_int(struct json_object *, const char *key, int64_t value);
-int json_set_const_key(struct json_object *, const char *, struct json_object *value);
-int json_set_string_const_key(struct json_object *, const char *, const char *value);
-int json_set_int_const_key(struct json_object *, const char *, int64_t value);
+int libjson_set_const_key(struct json_object *, const char *, struct json_object *value);
+int libjson_set_string_const_key(struct json_object *, const char *, const char *value);
+int libjson_set_int_const_key(struct json_object *, const char *, int64_t value);
-int json_append(struct json_object *arr, struct json_object *elem);
+int libjson_append(struct json_object *arr, struct json_object *elem);
#endif