]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
jsonwrt: add ul_jsonwrt_flush
authorThomas Weißschuh <thomas@t-8ch.de>
Sun, 10 Mar 2024 06:17:25 +0000 (07:17 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 20 Mar 2024 13:04:44 +0000 (14:04 +0100)
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
include/jsonwrt.h
lib/jsonwrt.c

index b450afcf87883491374f40eb05930834a465babe..1944d993dc3414033c27e808ddd488a7fc74dc24 100644 (file)
@@ -23,6 +23,7 @@ int ul_jsonwrt_is_ready(struct ul_jsonwrt *fmt);
 void ul_jsonwrt_indent(struct ul_jsonwrt *fmt);
 void ul_jsonwrt_open(struct ul_jsonwrt *fmt, const char *name, int type);
 void ul_jsonwrt_close(struct ul_jsonwrt *fmt, int type);
+void ul_jsonwrt_flush(struct ul_jsonwrt *fmt);
 
 #define ul_jsonwrt_root_open(_f)       ul_jsonwrt_open(_f, NULL, UL_JSON_OBJECT)
 #define ul_jsonwrt_root_close(_f)      ul_jsonwrt_close(_f, UL_JSON_OBJECT)
index 243ed82326d9cf7c2a48e04b36aab92f170d1241..e21368de2ac1ab3f5a85022509c60b3f59a4bbab 100644 (file)
@@ -178,6 +178,11 @@ void ul_jsonwrt_close(struct ul_jsonwrt *fmt, int type)
        fmt->after_close = 1;
 }
 
+void ul_jsonwrt_flush(struct ul_jsonwrt *fmt)
+{
+       fflush(fmt->out);
+}
+
 void ul_jsonwrt_value_raw(struct ul_jsonwrt *fmt,
                        const char *name, const char *data)
 {