]> git.ipfire.org Git - pakfire.git/commitdiff
json: Add a function to add NULL to an object
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 26 Jun 2025 13:11:22 +0000 (13:11 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 26 Jun 2025 13:11:22 +0000 (13:11 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/json.c
src/pakfire/json.h

index a2e73738cac7fb73c07220730b80a0157317901d..c0cda39fcfdb705bcb6ad4c4c56bf9f5750b1457 100644 (file)
@@ -151,6 +151,10 @@ int pakfire_json_new_object(struct json_object** json) {
        return 0;
 }
 
+int pakfire_json_add_null(struct json_object* json, const char* name) {
+       return json_object_object_add(json, name, NULL);
+}
+
 int pakfire_json_add_string(struct json_object* json,
                const char* name, const char* value) {
        if (!value)
index d4b7c36d79c72f0fb9fcfcfef7d695fad78c17da..3f70ba6f27068fecfa9d1c589f3109539ced905d 100644 (file)
@@ -43,6 +43,7 @@ int pakfire_json_parse_from_file(struct json_object** json, char** error, const
 
 int pakfire_json_new_object(struct json_object** json);
 
+int pakfire_json_add_null(struct json_object* json, const char* name);
 int pakfire_json_add_string(struct json_object* json, const char* name, const char* value);
 int pakfire_json_add_stringn(struct json_object* json, const char* name, const char* value, size_t length);
 int pakfire_json_add_stringf(struct json_object* json, const char* name, const char* format, ...)