aboutsummaryrefslogtreecommitdiff
path: root/analyzer/utils/memory.h
diff options
context:
space:
mode:
authorMosder <xmosder12@gmail.com>2026-07-28 16:38:04 +0200
committerMosder <xmosder12@gmail.com>2026-07-28 16:38:04 +0200
commit9e874301350a70a1ba40b5508878d559f68f8f4a (patch)
tree89f561b31bdda9bed936961dd7ef0268228a5b69 /analyzer/utils/memory.h
parent95763527e73c0d06d3887e4a2da22f627f13bfaa (diff)
refactor: generalized dynamic arrays with structures/array.h
Diffstat (limited to 'analyzer/utils/memory.h')
-rw-r--r--analyzer/utils/memory.h26
1 files changed, 4 insertions, 22 deletions
diff --git a/analyzer/utils/memory.h b/analyzer/utils/memory.h
index 0973623..8f01ba4 100644
--- a/analyzer/utils/memory.h
+++ b/analyzer/utils/memory.h
@@ -3,6 +3,9 @@
#include <stddef.h>
+#ifndef MEMORY_H
+#define MEMORY_H
+
#define ARR_LEN(arr) (sizeof(arr) / sizeof(arr[0]))
#define MAX_ALLOC_ATTEMPTS 3
@@ -22,25 +25,4 @@ extern void *safe_malloc(size_t size);
// pointer to the reallocated memory
extern void *safe_realloc(void *ptr, size_t size);
-// append to array, expand if necessary
-// params:
-// - arr - array to append to
-// - el_size - size of an array element
-// - len - pointer to the length of the array
-// - cap - pointer to the capacity of the array
-// - val - pointer to the value to append to the array
-// returns:
-// new pointer to the array (different if it was realloced)
-extern void *array_append(void *arr, size_t el_size, size_t *len, size_t *cap, void *val);
-
-// concatenate 2 arrays, expand if necessary
-// params:
-// - arr1 - first array (destination)
-// - el_size - size of an array element
-// - len1 - pointer to the length of arr1
-// - cap - pointer to the capacity of arr1
-// - arr2 - second array
-// - len2 - length of arr2
-// returns:
-// new pointer to the array (different if it was realloced)
-extern void *array_concat(void *arr1, size_t el_size, size_t *len1, size_t *cap, void *arr2, size_t len2);
+#endif