Add lttng_dynamic_buffer_append_view util
[lttng-tools.git] / src / common / dynamic-buffer.c
index aef80dded0bab2785820f7cf8acb1f7b9071cf7b..9aa0bb3c94800068222eec05b98d52d4d4cf3fa9 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 #include <common/dynamic-buffer.h>
+#include <common/buffer-view.h>
 #include <common/utils.h>
 #include <assert.h>
 
@@ -93,6 +94,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.023694 seconds and 4 git commands to generate.