Annotation of embedaddon/lighttpd/src/vector.c, revision 1.1.1.1

1.1       misho       1: #include "first.h"
                      2: 
                      3: #include "vector.h"
                      4: #include "base.h"
                      5: 
                      6: void *vector_realloc(void *data, size_t elem_size, size_t size, size_t used) {
                      7:        const size_t total_size = elem_size * size;
                      8:        const size_t used_size = elem_size * used;
                      9:        force_assert(size <= SIZE_MAX / elem_size);
                     10:        data = realloc(data, total_size);
                     11:        force_assert(NULL != data);
                     12: 
                     13:        /* clear new memory */
                     14:        memset(((char*)data) + used_size, 0, total_size - used_size);
                     15: 
                     16:        return data;
                     17: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>