X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fprocd.git;a=blobdiff_plain;f=service%2Fvalidate.c;h=cf04490f98f13962d80c9decedc110acc34c48ed;hp=3312d1dda956adf134e226226a6e866ae8d99f40;hb=8ce928994027019c858a523f2a2078736f8e2c5d;hpb=54829607535631a6701a16113c95a0c09cbd45d8;ds=sidebyside diff --git a/service/validate.c b/service/validate.c index 3312d1d..cf04490 100644 --- a/service/validate.c +++ b/service/validate.c @@ -13,6 +13,7 @@ #include #include +#include #include "../procd.h" @@ -31,7 +32,7 @@ static const struct blobmsg_policy service_validate_attrs[__SERVICE_VAL_MAX] = { [SERVICE_VAL_DATA] = { "data", BLOBMSG_TYPE_TABLE }, }; -static struct avl_tree validators; +static AVL_TREE(validators, avl_strcmp, true, NULL); void service_validate_dump_all(struct blob_buf *b, char *p, char *s) @@ -52,12 +53,12 @@ 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); + json_object_object_get_ex(r, v->package, &o); if (!o) { o = json_object_new_object(); json_object_object_add(r, v->package, o); } - t = json_object_object_get(o, v->type); + json_object_object_get_ex(o, v->type, &t); if (!t) { t = json_object_new_object(); json_object_object_add(o, v->type, t); @@ -154,9 +155,3 @@ service_validate_add(struct service *s, struct blob_attr *msg) free(vr); } } - -void -service_validate_init(void) -{ - avl_init(&validators, avl_strcmp, true, NULL); -}