diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2011-09-21 03:59:15 +0400 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-09-21 03:59:15 +0400 |
commit | 16714245f9a16ce3725aab079aea7b0d28c6b32f (patch) | |
tree | 41edbcd1c279b2baae2d5e5751639076e0a3bfad /include/libbb.h | |
parent | 5c6ba6c56f9653488e1d805e727bb06c39ed23fa (diff) |
add INIT_G()'s. No code changes.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'include/libbb.h')
-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; void *xmalloc(size_t size) FAST_FUNC RETURNS_MALLOC; void *xzalloc(size_t size) FAST_FUNC RETURNS_MALLOC; void *xrealloc(void *old, size_t size) FAST_FUNC; -/* After xrealloc_vector(v, 4, idx) it's ok to use +/* After v = xrealloc_vector(v, SHIFT, 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. */ + * 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. + * xrealloc_vector(v, SHIFT, idx) *MUST* be called with consecutive IDXs - + * skipping an index is a bad bug - it may miss a realloc! + */ #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; |