summaryrefslogtreecommitdiff
path: root/helpers_array.h
diff options
context:
space:
mode:
Diffstat (limited to 'helpers_array.h')
-rw-r--r--helpers_array.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/helpers_array.h b/helpers_array.h
new file mode 100644
index 0000000..2893976
--- /dev/null
+++ b/helpers_array.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2017 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+struct drv_array;
+
+struct drv_array *drv_array_init(uint32_t item_size);
+
+/* The data will be copied and appended to the array. */
+void *drv_array_append(struct drv_array *array, void *data);
+
+/* The data at the specified index will be freed -- the array will shrink. */
+void drv_array_remove(struct drv_array *array, uint32_t idx);
+
+void *drv_array_at_idx(struct drv_array *array, uint32_t idx);
+
+uint32_t drv_array_size(struct drv_array *array);
+
+/* The array and all associated data will be freed. */
+void drv_array_destroy(struct drv_array *array);