From 2d220bbac515b0dd4e4d460453df943f88172f61 Mon Sep 17 00:00:00 2001 From: liquidaty Date: Fri, 16 Sep 2022 21:48:17 -0700 Subject: [PATCH] add jsonwriter_object_keyn --- jsonwriter.c | 2 +- jsonwriter.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/jsonwriter.c b/jsonwriter.c index ab9e08c..085a54b 100644 --- a/jsonwriter.c +++ b/jsonwriter.c @@ -279,7 +279,7 @@ int jsonwriter_strn(jsonwriter_handle data, const unsigned char *s, size_t len) return 1; } -static int jsonwriter_object_keyn(jsonwriter_handle data, const char *key, size_t len_or_zero) { +int jsonwriter_object_keyn(jsonwriter_handle data, const char *key, size_t len_or_zero) { if(data->depth < JSONWRITER_MAX_NESTING) { jsonwriter_indent(data, 0); jsonwriter_str1(data, (const unsigned char *)key, len_or_zero == 0 ? JSW_STRLEN(key) : len_or_zero); diff --git a/jsonwriter.h b/jsonwriter.h index 98fce92..ca7e7de 100644 --- a/jsonwriter.h +++ b/jsonwriter.h @@ -61,6 +61,7 @@ extern "C" { // return an error if no matching open array/obj int jsonwriter_end_all(jsonwriter_handle h); + int jsonwriter_object_keyn(jsonwriter_handle data, const char *key, size_t len_or_zero); int jsonwriter_object_key(jsonwriter_handle h, const char *key); #define jsonwriter_object_str(h, key, v) jsonwriter_object_key(h, key), jsonwriter_str(h, v) #define jsonwriter_object_strn(h, key, v, len) jsonwriter_object_key(h, key), jsonwriter_strn(h, v, len)