Permalink
Browse files

kson_query() -> kson_by_path() for clarity

  • Loading branch information...
1 parent e06f674 commit 2cf8fa23abfda93e3a83e97e9ae93f13f5fa01f7 @lh3 lh3 committed Nov 30, 2014
Showing with 3 additions and 3 deletions.
  1. +2 −2 kson.c
  2. +1 −1 kson.h
View
4 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);
View
2 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

0 comments on commit 2cf8fa2

Please sign in to comment.