48 lines
1.5 KiB
Diff
48 lines
1.5 KiB
Diff
|
|
From 79e77816c424e25d9299ea4d63f5c0c7cfe1844f Mon Sep 17 00:00:00 2001
|
||
|
|
From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas@t-8ch.de>
|
||
|
|
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=UTF-8
|
||
|
|
Content-Transfer-Encoding: 8bit
|
||
|
|
|
||
|
|
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
|
||
|
|
Reference:https://github.com/util-linux/util-linux/commit/79e77816c424e25d9299ea4d63f5c0c7cfe1844f
|
||
|
|
Conflict:NA
|
||
|
|
---
|
||
|
|
include/jsonwrt.h | 1 +
|
||
|
|
lib/jsonwrt.c | 5 +++++
|
||
|
|
2 files changed, 6 insertions(+)
|
||
|
|
|
||
|
|
diff --git a/include/jsonwrt.h b/include/jsonwrt.h
|
||
|
|
index b450afcf..1944d993 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 243ed823..e21368de 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.33.0
|
||
|
|
|