aboutsummaryrefslogtreecommitdiff
path: root/include/libbb.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/libbb.h')
-rw-r--r--include/libbb.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 2dcdeacb1..f7a68492c 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -570,6 +570,10 @@ void *malloc_or_warn(size_t size) FAST_FUNC;
void *xmalloc(size_t size) FAST_FUNC;
void *xzalloc(size_t size) FAST_FUNC;
void *xrealloc(void *old, size_t size) FAST_FUNC;
+/* After xrealloc_vector(v, 4, idx) it's ok to use
+ * at least v[idx] and v[idx+1], for all idx values.
+ * shift specifies how many new elements are added (1: 2, 2: 4... 8: 256...)
+ * when all elements are used up. New elements are zeroed out. */
#define xrealloc_vector(vector, shift, idx) \
xrealloc_vector_helper((vector), (sizeof((vector)[0]) << 8) + (shift), (idx))
void* xrealloc_vector_helper(void *vector, unsigned sizeof_and_shift, int idx) FAST_FUNC;