[OpenWrt-Devel] [PATCH 2/2] Fix use of functions deprecated in json-c.0.12
Karl Palsson
karlp at tweak.net.au
Fri Feb 27 05:25:40 EST 2015
These have been deprecated for a very long time, the alternative
functions have been available since json-c 10 and 11 were pushed in AA
branch. I don't think there should be any need to keep the older form
in the #def, just only support the newer style.
Sincerely,
Karl P
William Holland <william.holland at codethink.co.uk> wrote:
> ---
> service/validate.c | 31 +++++++++++++++++++++----------
> 1 file changed, 21 insertions(+), 10 deletions(-)
>
> diff --git a/service/validate.c b/service/validate.c
> index 0e45493..2297b4d 100644
> --- a/service/validate.c
> +++ b/service/validate.c
> @@ -57,16 +57,27 @@ service_validate_dump_all(struct blob_buf *b, char *p, char *s)
> if (s && strcmp(s, v->type))
> continue;
>
> - o = json_object_object_get(r, v->package);
> - if (!o) {
> - o = json_object_new_object();
> - json_object_object_add(r, v->package, o);
> - }
> - t = json_object_object_get(o, v->type);
> - if (!t) {
> - t = json_object_new_object();
> - json_object_object_add(o, v->type, t);
> - }
> + #ifdef JSONC
> + if (!json_object_object_get_ex(r, v->package, &o)) {
> + o = json_object_new_object();
> + json_object_object_add(r, v->package, o);
> + }
> + if (!json_object_object_get_ex(o, v->type, &t)) {
> + t = json_object_new_object();
> + json_object_object_add(o, v->type, t);
> + }
> + #else
> + o = json_object_object_get(r, v->package);
> + if (!o) {
> + o = json_object_new_object();
> + json_object_object_add(r, v->package, o);
> + }
> + t = json_object_object_get(o, v->type);
> + if (!t) {
> + t = json_object_new_object();
> + json_object_object_add(o, v->type, t);
> + }
> + #endif
> avl_for_each_element(&v->rules, vr, avl)
> json_object_object_add(t, vr->option, json_object_new_string(vr->rule));
> }
> --
> 1.7.10.4
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
--
Sent using Mailpile, Free Software from www.mailpile.is
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list