config: replace config_memdup with blob_memdup from libubox
authorFelix Fietkau <nbd@openwrt.org>
Mon, 10 Jun 2013 11:23:06 +0000 (13:23 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 10 Jun 2013 11:23:12 +0000 (13:23 +0200)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
config.c
config.h
device.c

index f3e5f9d..9c1127b 100644 (file)
--- a/config.c
+++ b/config.c
@@ -366,20 +366,6 @@ config_check_equal(struct blob_attr *c1, struct blob_attr *c2,
        return true;
 }
 
        return true;
 }
 
-struct blob_attr *
-config_memdup(struct blob_attr *attr)
-{
-       struct blob_attr *ret;
-       int size = blob_pad_len(attr);
-
-       ret = malloc(size);
-       if (!ret)
-               return NULL;
-
-       memcpy(ret, attr, size);
-       return ret;
-}
-
 static struct uci_package *
 config_init_package(const char *config)
 {
 static struct uci_package *
 config_init_package(const char *config)
 {
index c5e4200..975ba24 100644 (file)
--- a/config.h
+++ b/config.h
@@ -58,6 +58,4 @@ bool config_check_equal(struct blob_attr *c1, struct blob_attr *c2,
 bool config_diff(struct blob_attr **tb1, struct blob_attr **tb2,
                 const struct config_param_list *config, unsigned long *diff);
 
 bool config_diff(struct blob_attr **tb1, struct blob_attr **tb2,
                 const struct config_param_list *config, unsigned long *diff);
 
-struct blob_attr *config_memdup(struct blob_attr *attr);
-
 #endif
 #endif
index 1c0736f..5fa0ac1 100644 (file)
--- a/device.c
+++ b/device.c
@@ -584,7 +584,7 @@ device_create(const char *name, const struct device_type *type,
        struct device *odev = NULL, *dev;
        enum dev_change_type change;
 
        struct device *odev = NULL, *dev;
        enum dev_change_type change;
 
-       config = config_memdup(config);
+       config = blob_memdup(config);
        if (!config)
                return NULL;
 
        if (!config)
                return NULL;