diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2017-07-10 17:08:58 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2017-07-10 18:26:05 +0200 |
| commit | 6e0532af78294c76d0e0a187a40d330518bab0a8 (patch) | |
| tree | b59cf41605d3fbe97335ca8f6cb22943e2c36d96 /array.h | |
| parent | 19a5d3c16ff5ef6861b5d2f0c5e0e4ce06ee73d0 (diff) | |
| download | vis-6e0532af78294c76d0e0a187a40d330518bab0a8.tar.gz vis-6e0532af78294c76d0e0a187a40d330518bab0a8.tar.xz | |
array: add helper functions for LIFO usage
Diffstat (limited to 'array.h')
| -rw-r--r-- | array.h | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -108,5 +108,26 @@ bool array_resize(Array*, size_t length); * Sort array, the comparision function works as for `qsort(3)`. */ void array_sort(Array*, int (*compar)(const void*, const void*)); +/** + * Push item onto the top of the stack. + * @rst + * .. note:: Is equivalent to ``array_add(arr, item)``. + * @endrst + */ +bool array_push(Array*, void *item); +/** + * Get and remove item at the top of the stack. + * @rst + * .. warning:: The same ownership rules as for ``array_get`` apply. + * @endrst + */ +void *array_pop(Array*); +/** + * Get item at the top of the stack without removing it. + * @rst + * .. warning:: The same ownership rules as for ``array_get`` apply. + * @endrst + */ +void *array_peek(Array*); #endif |
