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 31fc4673c9ce2867f9e026bf358fd2995d10a0b7..ef706853e7806771cff66274a35433457f0e7ab7 100644 (file)
--- a/device.c
+++ b/device.c
@@ -3,14 +3,12 @@
 #include <stdio.h>
 #include <assert.h>
 
-#include <libubox/uapi.h>
-
 #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);
 }
index 771bcea69c21336e3b6598930c0439b447c944de..b70b73c435b799abecb10df4de6189b701f3237a 100644 (file)
--- a/netifd.h
+++ b/netifd.h
@@ -19,6 +19,8 @@
 #define DPRINTF(...) do {} while(0)
 #endif
 
+#define __init __attribute__((constructor))
+
 struct device;
 struct interface;