wl_array(3)
πΈ NAME πΈ
wl_array β bestie, this is the manual page for the dynamic array queen herself, wl_array(3), from the library functions manual. Sheβs giving grow-only icon energy, and sheβs here to hold your variable-sized little collection. π
β¨ SYNOPSIS β¨
#include <wayland-util.h>
π Public Member Functions π
void wl_array_init (struct wl_array *array)β initializes the array. Gets it set up and ready, bestie.void wl_array_release (struct wl_array *array)β releases the array data. Heads up: this leaves the array in an invalid state, details below. πvoid * wl_array_add (struct wl_array *array, size_t size)β increases the array size bysizebytes and hands you a pointer to the new space.int wl_array_copy (struct wl_array *array, struct wl_array *source)β copies the contents ofsourceintoarray.
π¦ Data Fields π¦
size_t sizeβ array size.size_t allocβ allocated space.void * dataβ array data.
π Related Symbols π
Not me reminding you: these are not member symbols. The original note is β(Note that these are not member symbols.)β β so donβt get it twisted, bestie. π
#define wl_array_for_each(pos, array)β the for-each macro, with full details down below.
π¦ Detailed Description π¦
Dynamic array, periodt. A wl_array is a dynamic array that can only grow until itβs released. Itβs intended for relatively small allocations whose size is variable or not known in advance. While construction of a wl_array does not require all elements to be of the same size, wl_array_for_each() does require all elements to have the same type and size. No cap.
π Member Function Documentation π
void * wl_array_add (struct wl_array * array, size_t size)
Increases the size of the array by size bytes. Slay.
Parameters
arrayβ Array whose size is to be increasedsizeβ Number of bytes to increase the size of the array by
Returns: A pointer to the beginning of the newly appended space, or NULL when resizing fails. If itβs NULL, thatβs the vibe check failing, fr fr.
int wl_array_copy (struct wl_array * array, struct wl_array * source)
Copies the contents of source to array. Iconic copy-paste behavior. π«Ά
Parameters
arrayβ Destination array to copy tosourceβ Source array to copy from
Returns: 0 on success, or -1 on failure.
void wl_array_init (struct wl_array * array)
Initializes the array.
Parameters
arrayβ Array to initialize
void wl_array_release (struct wl_array * array)
Releases the array data.
Note: Leaves the array in an invalid state. Thatβs the note, bestie β itβs invalid after this, so donβt act brand new. π
Parameters
arrayβ Array whose data is to be released
π§ Friends And Related Symbol Documentation π§
#define wl_array_for_each( pos, array) [related]
Value:
for (pos = (array)->data; \
(array)->size != 0 && \
(const char *) pos < ((const char *) (array)->data + (array)->size); \
(pos)++)
Iterates over an array.
This macro expresses a for-each iterator for wl_array. It assigns each element in the array to pos, which can then be referenced in a trailing code block. pos must be a pointer to the array element type, and all array elements must be of the same type and size.
Parameters
posβ Cursor that each array element will be assigned toarrayβ Array to iterate over
See also: wl_list_for_each()
π Field Documentation π
size_t wl_array::alloc
Allocated space.
void* wl_array::data
Array data.
size_t wl_array::size
Array size.
π Author π
Generated automatically by Doxygen for Wayland from the source code.
Signed off from Wayland, Version 1.26.0, for wl_array(3) β and the footer didnβt give me a date, so Iβm not inventing one, bestie. Periodt. π
π
π¦ where this page comes from
- ubuntu stonking: libwayland-doc 1.26.0-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms