From 79e77816c424e25d9299ea4d63f5c0c7cfe1844f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20Wei=C3=9Fschuh?= Date: Sun, 10 Mar 2024 07:17:25 +0100 Subject: [PATCH] jsonwrt: add ul_jsonwrt_flush MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Thomas Weißschuh --- include/jsonwrt.h | 1 + lib/jsonwrt.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/include/jsonwrt.h b/include/jsonwrt.h index b450afcf87..1944d993dc 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 243ed82326..e21368de2a 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) { -- 2.47.2