File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / lighttpd / src / vector.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Nov 2 10:35:00 2016 UTC (8 years, 1 month ago) by misho
Branches: lighttpd, MAIN
CVS tags: v1_4_41p8, HEAD
lighttpd 1.4.41

#include "first.h"

#include "vector.h"
#include "base.h"

void *vector_realloc(void *data, size_t elem_size, size_t size, size_t used) {
	const size_t total_size = elem_size * size;
	const size_t used_size = elem_size * used;
	force_assert(size <= SIZE_MAX / elem_size);
	data = realloc(data, total_size);
	force_assert(NULL != data);

	/* clear new memory */
	memset(((char*)data) + used_size, 0, total_size - used_size);

	return data;
}

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