blob: 77544d313e6f3f3afa1f5a8f147576726f5109f0 [file] [log] [blame]
Gurchetan Singh39f66c02017-11-02 16:42:49 -07001/*
2 * Copyright 2017 The Chromium OS Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 */
6
Yiwei Zhangb7a64442021-09-30 05:13:10 +00007#ifndef DRV_ARRAY_HELPERS_H
8#define DRV_ARRAY_HELPERS_H
9
10#include <stdint.h>
11
Gurchetan Singh39f66c02017-11-02 16:42:49 -070012struct drv_array;
13
14struct drv_array *drv_array_init(uint32_t item_size);
15
16/* The data will be copied and appended to the array. */
17void *drv_array_append(struct drv_array *array, void *data);
18
19/* The data at the specified index will be freed -- the array will shrink. */
20void drv_array_remove(struct drv_array *array, uint32_t idx);
21
22void *drv_array_at_idx(struct drv_array *array, uint32_t idx);
23
24uint32_t drv_array_size(struct drv_array *array);
25
26/* The array and all associated data will be freed. */
27void drv_array_destroy(struct drv_array *array);
Yiwei Zhangb7a64442021-09-30 05:13:10 +000028
29#endif