payload: don't re-initialize destination payload on copy
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 22 Jul 2020 20:43:26 +0000 (16:43 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 27 Jul 2020 20:31:46 +0000 (16:31 -0400)
This makes it possible to re-use the same destination payload
and not always re-allocate memory for its underlying arrays.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I959b2e8851a81034b681d7188c504752620e1b50

src/common/payload.c

index 635d3e3fbc65bdda94386ec1111ca92e45d01fb5..c4faece18fcadb84fe94fd33ccca23ac857ca85a 100644 (file)
@@ -25,7 +25,6 @@ int lttng_payload_copy(const struct lttng_payload *src_payload,
        int ret;
        size_t i;
 
-       lttng_payload_init(dst_payload);
        ret = lttng_dynamic_buffer_append_buffer(
                        &dst_payload->buffer, &src_payload->buffer);
        if (ret) {
@@ -60,7 +59,6 @@ int lttng_payload_copy(const struct lttng_payload *src_payload,
 end:
        return ret;
 error:
-       lttng_payload_reset(dst_payload);
        goto end;
 }
 
This page took 0.02555 seconds and 4 git commands to generate.