diff options
author | Kirill Primak <vyivel@eclair.cafe> | 2022-08-19 21:19:30 +0300 |
---|---|---|
committer | Simon Zeni <simon@bl4ckb0ne.ca> | 2022-08-29 13:48:42 +0000 |
commit | 20c208d46a140e148da29730a3adbfa9b88de467 (patch) | |
tree | d4dbb917ec6c7e77692adafc8b87d5e5d3a131f8 /include/util | |
parent | eee0f5e71f4e3a6ded27d2d5046a243277c00ab8 (diff) |
util/array: unclutter
Diffstat (limited to 'include/util')
-rw-r--r-- | include/util/array.h | 17 | ||||
-rw-r--r-- | include/util/set.h | 25 |
2 files changed, 25 insertions, 17 deletions
diff --git a/include/util/array.h b/include/util/array.h index 2b7278cc..a51bdb64 100644 --- a/include/util/array.h +++ b/include/util/array.h @@ -1,27 +1,10 @@ #ifndef UTIL_ARRAY_H #define UTIL_ARRAY_H -#include <stdint.h> #include <stdlib.h> #include <stdbool.h> #include <wayland-util.h> -size_t push_zeroes_to_end(uint32_t arr[], size_t n); - -/** - * Add `target` to `values` if it doesn't exist - * "set"s should only be modified with set_* functions - * Values MUST be greater than 0 - */ -bool set_add(uint32_t values[], size_t *len, size_t cap, uint32_t target); - -/** - * Remove `target` from `values` if it exists - * "set"s should only be modified with set_* functions - * Values MUST be greater than 0 - */ -bool set_remove(uint32_t values[], size_t *len, size_t cap, uint32_t target); - /** * Remove a chunk of memory of the specified size at the specified offset. */ diff --git a/include/util/set.h b/include/util/set.h new file mode 100644 index 00000000..41099621 --- /dev/null +++ b/include/util/set.h @@ -0,0 +1,25 @@ +#ifndef UTIL_SET_H +#define UTIL_SET_H + +#include <stdint.h> +#include <stdlib.h> +#include <stdbool.h> + +size_t push_zeroes_to_end(uint32_t arr[], size_t n); + +/** + * Add `target` to `values` if it doesn't exist + * "set"s should only be modified with set_* functions + * Values MUST be greater than 0 + */ +bool set_add(uint32_t values[], size_t *len, size_t cap, uint32_t target); + +/** + * Remove `target` from `values` if it exists + * "set"s should only be modified with set_* functions + * Values MUST be greater than 0 + */ +bool set_remove(uint32_t values[], size_t *len, size_t cap, uint32_t target); + +#endif + |