mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-10 03:50:38 +03:00
Partial import of xs_json_load() from xs.
This commit is contained in:
parent
294675ae9a
commit
d8f2bb1128
10
xs_json.h
10
xs_json.h
@ -8,6 +8,7 @@ xs_str *xs_json_dumps_pp(const xs_val *data, int indent);
|
|||||||
int xs_json_dump_pp(const xs_val *data, int indent, FILE *f);
|
int xs_json_dump_pp(const xs_val *data, int indent, FILE *f);
|
||||||
#define xs_json_dumps(data) xs_json_dumps_pp(data, 0)
|
#define xs_json_dumps(data) xs_json_dumps_pp(data, 0)
|
||||||
xs_val *xs_json_loads(const xs_str *json);
|
xs_val *xs_json_loads(const xs_str *json);
|
||||||
|
xs_val *xs_json_load(FILE *f);
|
||||||
|
|
||||||
|
|
||||||
#ifdef XS_IMPLEMENTATION
|
#ifdef XS_IMPLEMENTATION
|
||||||
@ -539,6 +540,15 @@ xs_val *xs_json_loads(const xs_str *json)
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
xs_val *xs_json_load(FILE *f)
|
||||||
|
/* loads a JSON file */
|
||||||
|
{
|
||||||
|
xs *o = xs_readall(f);
|
||||||
|
return o ? xs_json_loads(o) : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* XS_IMPLEMENTATION */
|
#endif /* XS_IMPLEMENTATION */
|
||||||
|
|
||||||
#endif /* _XS_JSON_H */
|
#endif /* _XS_JSON_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user