2018-07-07 17:56:37 +02:00
|
|
|
#ifndef UTIL_ARRAY_H
|
|
|
|
|
#define UTIL_ARRAY_H
|
|
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
2019-06-15 11:08:53 -07:00
|
|
|
#include <stdbool.h>
|
2021-07-01 09:57:30 +02:00
|
|
|
#include <wayland-util.h>
|
2018-07-07 17:56:37 +02:00
|
|
|
|
2021-07-01 09:57:30 +02:00
|
|
|
/**
|
|
|
|
|
* Remove a chunk of memory of the specified size at the specified offset.
|
|
|
|
|
*/
|
|
|
|
|
void array_remove_at(struct wl_array *arr, size_t offset, size_t size);
|
|
|
|
|
|
2022-08-18 11:51:21 +02:00
|
|
|
/**
|
|
|
|
|
* Grow or shrink the array to fit the specifized size.
|
|
|
|
|
*/
|
|
|
|
|
bool array_realloc(struct wl_array *arr, size_t size);
|
|
|
|
|
|
2022-08-25 21:55:46 -04:00
|
|
|
/**
|
|
|
|
|
* Returns a pointer to the first valid element in a reversed array.
|
|
|
|
|
*/
|
|
|
|
|
void *array_reversed_start(struct wl_array *arr);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Adds a new element to the array inserting them starting from a higher
|
|
|
|
|
* memory address effectively inserting them in reverse order.
|
|
|
|
|
*/
|
|
|
|
|
void *array_reversed_add(struct wl_array *arr, size_t size);
|
|
|
|
|
|
2018-07-07 17:56:37 +02:00
|
|
|
#endif
|