Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
J
json-editor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IOPSYS
json-editor
Commits
f70b0622
Commit
f70b0622
authored
5 years ago
by
Jakob Olsson
Browse files
Options
Downloads
Patches
Plain Diff
json_editor: minor stylistic fixes and remove unused vars
parent
57c61505
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/json-editor.c
+5
-2
5 additions, 2 deletions
src/json-editor.c
with
5 additions
and
2 deletions
src/json-editor.c
+
5
−
2
View file @
f70b0622
...
...
@@ -482,6 +482,7 @@ struct json_object *json_object_get_by_string_delimiter(struct json_object *src,
for
(
char
*
key
=
strtok
(
fmt_cpy
,
delimiter
);
key
!=
NULL
;
key
=
strtok
(
NULL
,
delimiter
))
{
int
len
=
0
;
len
=
get_idx
(
key
,
idx
,
parsed_key
);
json_object_object_get_ex
(
outer_obj
,
parsed_key
,
&
ptr
);
...
...
@@ -490,6 +491,7 @@ struct json_object *json_object_get_by_string_delimiter(struct json_object *src,
return
NULL
;
int
index
=
(
idx
[
i
]
==
-
1
?
json_object_array_length
(
ptr
)
-
1
:
idx
[
i
]);
ptr
=
json_object_array_get_idx
(
ptr
,
index
);
}
...
...
@@ -507,11 +509,10 @@ int json_object_del_by_string(struct json_object *src, char *fmt)
int
json_object_del_by_string_delimiter
(
struct
json_object
*
src
,
char
*
fmt
,
const
char
*
delimiter
)
{
struct
json_object
*
ptr
,
*
outer_obj
,
*
j_idx
;
struct
json_object
*
ptr
,
*
outer_obj
;
char
fmt_cpy
[
1024
]
=
{
0
},
parsed_key
[
32
]
=
{
0
};
char
*
p
,
*
key
=
fmt
;
int
idx
[
32
];
int
len
;
if
(
!
src
)
{
fprintf
(
stderr
,
"%s error: No object
\n
"
,
__func__
);
...
...
@@ -534,6 +535,7 @@ int json_object_del_by_string_delimiter(struct json_object *src, char *fmt, cons
if
(
p
)
{
int
len
=
0
;
len
=
get_idx
(
key
,
idx
,
parsed_key
);
json_object_object_get_ex
(
outer_obj
,
parsed_key
,
&
ptr
);
...
...
@@ -542,6 +544,7 @@ int json_object_del_by_string_delimiter(struct json_object *src, char *fmt, cons
return
-
1
;
int
index
=
(
idx
[
i
]
==
-
1
?
json_object_array_length
(
ptr
)
-
1
:
idx
[
i
]);
ptr
=
json_object_array_get_idx
(
ptr
,
index
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment