From: Thomas Weißschuh Date: Sun, 10 Mar 2024 06:17:25 +0000 (+0100) Subject: jsonwrt: add ul_jsonwrt_flush X-Git-Tag: v2.42-start~490 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=79e77816c424e25d9299ea4d63f5c0c7cfe1844f;p=thirdparty%2Futil-linux.git jsonwrt: add ul_jsonwrt_flush Signed-off-by: Thomas Weißschuh --- diff --git a/include/jsonwrt.h b/include/jsonwrt.h index b450afcf8..1944d993d 100644 --- a/include/jsonwrt.h +++ b/include/jsonwrt.h @@ -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) diff --git a/lib/jsonwrt.c b/lib/jsonwrt.c index 243ed8232..e21368de2 100644 --- a/lib/jsonwrt.c +++ b/lib/jsonwrt.c @@ -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) {