add a __init define for constructors
authorFelix Fietkau <nbd@openwrt.org>
Wed, 13 Apr 2011 21:19:22 +0000 (23:19 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Wed, 13 Apr 2011 21:19:22 +0000 (23:19 +0200)
device.c
netifd.h

index 31fc467..ef70685 100644 (file)
--- a/device.c
+++ b/device.c
@@ -3,14 +3,12 @@
 #include <stdio.h>
 #include <assert.h>
 
 #include <stdio.h>
 #include <assert.h>
 
-#include <libubox/uapi.h>
-
 #include "netifd.h"
 #include "system.h"
 
 static struct avl_tree devices;
 
 #include "netifd.h"
 #include "system.h"
 
 static struct avl_tree devices;
 
-static void API_CTOR dev_init(void)
+static void __init dev_init(void)
 {
        avl_init(&devices, avl_strcmp, false, NULL);
 }
 {
        avl_init(&devices, avl_strcmp, false, NULL);
 }
index 771bcea..b70b73c 100644 (file)
--- a/netifd.h
+++ b/netifd.h
@@ -19,6 +19,8 @@
 #define DPRINTF(...) do {} while(0)
 #endif
 
 #define DPRINTF(...) do {} while(0)
 #endif
 
+#define __init __attribute__((constructor))
+
 struct device;
 struct interface;
 
 struct device;
 struct interface;