From 2cf8fa23abfda93e3a83e97e9ae93f13f5fa01f7 Mon Sep 17 00:00:00 2001 From: Heng Li Date: Sun, 30 Nov 2014 01:15:00 -0500 Subject: [PATCH] kson_query() -> kson_by_path() for clarity --- kson.c | 4 ++-- kson.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/kson.c b/kson.c index c5002fb..a8bf160 100644 --- a/kson.c +++ b/kson.c @@ -135,7 +135,7 @@ kson_t *kson_parse(const char *json) *** Query *** *************/ -const kson_node_t *kson_query(const kson_node_t *p, int depth, ...) +const kson_node_t *kson_by_path(const kson_node_t *p, int depth, ...) { va_list ap; va_start(ap, depth); @@ -239,7 +239,7 @@ int main(int argc, char *argv[]) } else { kson = kson_parse("{'a' : 1,'b':[0,'isn\\'t',true],'d':[{\n\n\n}]}"); if (kson) { - const kson_node_t *p = kson_query(kson->root, 2, "b", 1); + const kson_node_t *p = kson_by_path(kson->root, 2, "b", 1); if (p) printf("*** %s\n", p->v.str); else printf("!!! not found\n"); kson_format(kson->root); diff --git a/kson.h b/kson.h index 9c0eafc..a03eb52 100644 --- a/kson.h +++ b/kson.h @@ -34,7 +34,7 @@ extern "C" { kson_t *kson_parse(const char *json); void kson_destroy(kson_t *kson); - const kson_node_t *kson_query(const kson_node_t *root, int max_depth, ...); + const kson_node_t *kson_by_path(const kson_node_t *root, int path_len, ...); void kson_format(const kson_node_t *root); #ifdef __cplusplus