Skip to content

Commit

Permalink
add jsonwriter_object_keyn
Browse files Browse the repository at this point in the history
  • Loading branch information
liquidaty committed Sep 17, 2022
1 parent df5c398 commit 2d220bb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion jsonwriter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions jsonwriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2d220bb

Please sign in to comment.