service: get rid of service_init and service_validate_init, use static avl tree initi...
authorFelix Fietkau <nbd@openwrt.org>
Sat, 5 Mar 2016 13:08:59 +0000 (14:08 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Sat, 5 Mar 2016 13:08:59 +0000 (14:08 +0100)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
service/service.c
service/service.h
service/validate.c
state.c

index 2702dc3..0796adb 100644 (file)
@@ -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();
-}
-
index 892a147..c3f2964 100644 (file)
@@ -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
index 6a449f4..cf04490 100644 (file)
@@ -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 (file)
--- 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;