mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-26 23:25:56 -05:00
[misc] Add helper function to check if a key with a given type exists
This commit is contained in:
parent
1379ef235c
commit
83bb06225b
@ -46,6 +46,14 @@ jparse_free(json_object* haystack)
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
jparse_contains_key(json_object *haystack, const char *key, json_type type)
|
||||
{
|
||||
json_object *needle;
|
||||
|
||||
return json_object_object_get_ex(haystack, key, &needle) && json_object_get_type(needle) == type;
|
||||
}
|
||||
|
||||
int
|
||||
jparse_array_from_obj(json_object *haystack, const char *key, json_object **needle)
|
||||
{
|
||||
|
@ -36,6 +36,9 @@
|
||||
void
|
||||
jparse_free(json_object *haystack);
|
||||
|
||||
bool
|
||||
jparse_contains_key(json_object *haystack, const char *key, json_type type);
|
||||
|
||||
int
|
||||
jparse_array_from_obj(json_object *haystack, const char *key, json_object **needle);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user