Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/blob.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2012-06-01 22:54:05 +0400
committerFelix Fietkau <nbd@openwrt.org>2012-06-01 22:54:20 +0400
commit5cfe2696f0101dc3b304dbffeefd6723b7ec8453 (patch)
tree8c5e5b6edd33a411fd7e0b77ac228af958fc6257 /blob.c
parent0608d1299546d4af1facc271a090cb2abb8c6105 (diff)
blob: add blob_memdup()
Diffstat (limited to 'blob.c')
-rw-r--r--blob.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/blob.c b/blob.c
index 928b5c5..e74f07f 100644
--- a/blob.c
+++ b/blob.c
@@ -243,3 +243,17 @@ blob_attr_equal(const struct blob_attr *a1, const struct blob_attr *a2)
return !memcmp(a1, a2, blob_pad_len(a1));
}
+
+struct blob_attr *
+blob_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;
+}