Add explode/implode jq functions to match jv API

This commit is contained in:
Nicolas Williams committed 2013-12-04 18:21:38 -06:00
1 parent ef41d1cb57
commit 6c734cb609
2 files changed
+3 -1

No files matched your search

+2
View File
@@ -493,6 +493,8 @@ static const struct cfunction function_list[] = {
{(cfunction_ptr)f_tonumber, "tonumber", 1},
{(cfunction_ptr)f_tostring, "tostring", 1},
{(cfunction_ptr)f_keys, "keys", 1},
{(cfunction_ptr)jv_string_explode, "explode", 1},
{(cfunction_ptr)jv_string_implode, "implode", 1},
{(cfunction_ptr)jv_setpath, "setpath", 3}, // FIXME typechecking
{(cfunction_ptr)jv_getpath, "getpath", 2},
{(cfunction_ptr)jv_delpaths, "delpaths", 2},
+1 -1
View File
@@ -618,7 +618,7 @@ jv jv_string_implode(jv j) {
assert(len >= 0);
for (i = 0; i < len; i++) {
jv n = jv_array_get(j, i);
jv n = jv_array_get(jv_copy(j), i);
assert(jv_get_kind(n) == JV_KIND_NUMBER);
s = jv_string_append_codepoint(s, jv_number_value(n));
}