X-Git-Url: http://git.openwrt.org/?p=project%2Fubus.git;a=blobdiff_plain;f=ubusd.c;h=89031053a2386700d1c9bf6f4eb36e8aa1d6b60f;hp=bcc8603a60be678733ed5f4623d48eae4746a98e;hb=996e16b2cb79ae3e46742285ee2728f3a166b42a;hpb=5db90dbc941da701c397b04ddce2515a231df59b diff --git a/ubusd.c b/ubusd.c index bcc8603..8903105 100644 --- a/ubusd.c +++ b/ubusd.c @@ -29,22 +29,10 @@ #include "ubusd.h" -static struct ubus_msg_buf *ubus_msg_unshare(struct ubus_msg_buf *ub) -{ - ub = realloc(ub, sizeof(*ub) + ub->len); - if (!ub) - return NULL; - - ub->refcount = 1; - memcpy(ub + 1, ub->data, ub->len); - ub->data = (void *) (ub + 1); - return ub; -} - static struct ubus_msg_buf *ubus_msg_ref(struct ubus_msg_buf *ub) { if (ub->refcount == ~0) - return ubus_msg_unshare(ub); + return ubus_msg_new(ub->data, ub->len, false); ub->refcount++; return ub;