SoW-2019-0002: Dynamic Snapshot
[lttng-tools.git] / src / common / dynamic-array.h
index 208dd1956b41263df7f8336605f22e082bff21ac..2b3ea62731cb3c54a5cc17d2bbe8fd9b068744a5 100644 (file)
@@ -121,6 +121,23 @@ void *lttng_dynamic_pointer_array_get_pointer(
        return *element;
 }
 
+/*
+ * Returns the pointer at index `index`, sets the array slot to NULL. Does not
+ * run the destructor.
+ */
+
+static inline
+void *lttng_dynamic_pointer_array_steal_pointer(
+               struct lttng_dynamic_pointer_array *array, size_t index)
+{
+       void **p_element = lttng_dynamic_array_get_element(&array->array, index);
+       void *element = *p_element;
+
+       *p_element = NULL;
+
+       return element;
+}
+
 /*
  * Add a pointer to the end of a dynamic pointer array. The array's element
  * count is increased by one and its underlying capacity is adjusted
This page took 0.024102 seconds and 5 git commands to generate.