Add lttng_dynamic_buffer_append_view util
[lttng-tools.git] / src / common / dynamic-buffer.c
index 7005ef501776c0801f951e00b3a01aa17c699c85..b6544e62ba5f3f646bd9bd1630a9ca5668b5f190 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include <common/dynamic-buffer.h>
+#include <common/buffer-view.h>
 #include <common/utils.h>
 #include <assert.h>
 
@@ -83,6 +84,23 @@ end:
        return ret;
 }
 
+LTTNG_HIDDEN
+int lttng_dynamic_buffer_append_view(struct lttng_dynamic_buffer *buffer,
+               const struct lttng_buffer_view *src)
+{
+       int ret;
+
+       if (!buffer || !src) {
+               ret = -1;
+               goto end;
+       }
+
+       ret = lttng_dynamic_buffer_append(buffer, src->data,
+                       src->size);
+end:
+       return ret;
+}
+
 LTTNG_HIDDEN
 int lttng_dynamic_buffer_set_size(struct lttng_dynamic_buffer *buffer,
                size_t new_size)
This page took 0.023717 seconds and 5 git commands to generate.