diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/libbb.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/include/libbb.h b/include/libbb.h index feae85259..f79b69365 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -684,10 +684,13 @@ void *malloc_or_warn(size_t size) FAST_FUNC RETURNS_MALLOC; | |||
684 | void *xmalloc(size_t size) FAST_FUNC RETURNS_MALLOC; | 684 | void *xmalloc(size_t size) FAST_FUNC RETURNS_MALLOC; |
685 | void *xzalloc(size_t size) FAST_FUNC RETURNS_MALLOC; | 685 | void *xzalloc(size_t size) FAST_FUNC RETURNS_MALLOC; |
686 | void *xrealloc(void *old, size_t size) FAST_FUNC; | 686 | void *xrealloc(void *old, size_t size) FAST_FUNC; |
687 | /* After xrealloc_vector(v, 4, idx) it's ok to use | 687 | /* After v = xrealloc_vector(v, SHIFT, idx) it's ok to use |
688 | * at least v[idx] and v[idx+1], for all idx values. | 688 | * at least v[idx] and v[idx+1], for all idx values. |
689 | * shift specifies how many new elements are added (1: 2, 2: 4... 8: 256...) | 689 | * SHIFT specifies how many new elements are added (1:2, 2:4, ..., 8:256...) |
690 | * when all elements are used up. New elements are zeroed out. */ | 690 | * when all elements are used up. New elements are zeroed out. |
691 | * xrealloc_vector(v, SHIFT, idx) *MUST* be called with consecutive IDXs - | ||
692 | * skipping an index is a bad bug - it may miss a realloc! | ||
693 | */ | ||
691 | #define xrealloc_vector(vector, shift, idx) \ | 694 | #define xrealloc_vector(vector, shift, idx) \ |
692 | xrealloc_vector_helper((vector), (sizeof((vector)[0]) << 8) + (shift), (idx)) | 695 | xrealloc_vector_helper((vector), (sizeof((vector)[0]) << 8) + (shift), (idx)) |
693 | void* xrealloc_vector_helper(void *vector, unsigned sizeof_and_shift, int idx) FAST_FUNC; | 696 | void* xrealloc_vector_helper(void *vector, unsigned sizeof_and_shift, int idx) FAST_FUNC; |