X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=ubusd.c;h=89031053a2386700d1c9bf6f4eb36e8aa1d6b60f;hb=6280cbaf0966928c4f83b925fb5b94c3ecb1936e;hp=bcc8603a60be678733ed5f4623d48eae4746a98e;hpb=37cc5d2f25c162c1e125922e91bbc741e2e4a6d1;p=project%2Fubus.git 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;