From 8ce928994027019c858a523f2a2078736f8e2c5d Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 5 Mar 2016 14:08:59 +0100 Subject: [PATCH] service: get rid of service_init and service_validate_init, use static avl tree initialization Signed-off-by: Felix Fietkau --- service/service.c | 10 +--------- service/service.h | 2 -- service/validate.c | 8 +------- state.c | 1 - 4 files changed, 2 insertions(+), 19 deletions(-) diff --git a/service/service.c b/service/service.c index 2702dc3..0796adb 100644 --- a/service/service.c +++ b/service/service.c @@ -22,7 +22,7 @@ #include "../rcS.h" -struct avl_tree services; +AVL_TREE(services, avl_strcmp, false, NULL); static struct blob_buf b; static struct ubus_context *ctx; @@ -552,11 +552,3 @@ void ubus_init_service(struct ubus_context *_ctx) ctx = _ctx; ubus_add_object(ctx, &main_object); } - -void -service_init(void) -{ - avl_init(&services, avl_strcmp, false, NULL); - service_validate_init(); -} - diff --git a/service/service.h b/service/service.h index 892a147..c3f2964 100644 --- a/service/service.h +++ b/service/service.h @@ -51,8 +51,6 @@ void service_validate_dump(struct blob_buf *b, struct service *s); void service_validate_dump_all(struct blob_buf *b, char *p, char *s); int service_start_early(char *name, char *cmdline); void service_validate_del(struct service *s); -void service_validate_init(void); -void service_init(void); void service_event(const char *type, const char *service, const char *instance); #endif diff --git a/service/validate.c b/service/validate.c index 6a449f4..cf04490 100644 --- a/service/validate.c +++ b/service/validate.c @@ -32,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) @@ -155,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); -} diff --git a/state.c b/state.c index d51970e..4ad9e2d 100644 --- a/state.c +++ b/state.c @@ -111,7 +111,6 @@ static void state_enter(void) set_stdio("console"); LOG("- ubus -\n"); procd_connect_ubus(); - service_init(); service_start_early("ubus", ubus_cmd); break; -- 2.30.2