Skip to content

Commit

Permalink
Additional change to the code
Browse files Browse the repository at this point in the history
  • Loading branch information
zpl-zak committed Jul 4, 2019
1 parent 931fe29 commit 3af334d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 17 deletions.
12 changes: 4 additions & 8 deletions code/zpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
https://github.com/zpl-c/zpl

Version History:
9.4.7 - Additional change to the code
9.4.6 - Fix issue where zpl_json_find would have false match on substrings
9.4.5 - Mistakes were made, fixed compilation errors
9.4.3 - Fix old API shenanigans
9.4.2 - Fix small API typos
Expand Down Expand Up @@ -11237,14 +11239,8 @@ zpl_json_object *zpl_json_find(zpl_json_object *obj, char const *name, zpl_b32 d
}

for (zpl_isize i = 0; i < zpl_array_count(obj->nodes); i++)
{
zpl_isize a = zpl_strlen(name);
zpl_isize b = zpl_strlen(obj->nodes[i].name);

if (a != b)
continue;

if (!zpl_strncmp(obj->nodes[i].name, name, zpl_strlen(name)))
{
if (!zpl_strcmp(obj->nodes[i].name, name))
{
return (obj->nodes + i);
}
Expand Down
1 change: 1 addition & 0 deletions code/zpl/__main__.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
https://github.com/zpl-c/zpl
Version History:
9.4.7 - Additional change to the code
9.4.6 - Fix issue where zpl_json_find would have false match on substrings
9.4.5 - Mistakes were made, fixed compilation errors
9.4.3 - Fix old API shenanigans
Expand Down
10 changes: 2 additions & 8 deletions code/zpl/json.c
Original file line number Diff line number Diff line change
Expand Up @@ -837,14 +837,8 @@ zpl_json_object *zpl_json_find(zpl_json_object *obj, char const *name, zpl_b32 d
}

for (zpl_isize i = 0; i < zpl_array_count(obj->nodes); i++)
{
zpl_isize a = zpl_strlen(name);
zpl_isize b = zpl_strlen(obj->nodes[i].name);

if (a != b)
continue;

if (!zpl_strncmp(obj->nodes[i].name, name, zpl_strlen(name)))
{
if (!zpl_strcmp(obj->nodes[i].name, name))
{
return (obj->nodes + i);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zpl.c",
"version": "9.4.6",
"version": "9.4.7",
"description": "Single-file header-only C and C++ helper library.",
"main": "include/zpl.h",
"directories": {
Expand Down

0 comments on commit 3af334d

Please sign in to comment.