Example #1
0
void *dm_zalloc_aux_debug(size_t s, const char *file, int line)
{
	void *ptr = dm_malloc_aux_debug(s, file, line);

	if (ptr)
		memset(ptr, 0, s);

	return ptr;
}
Example #2
0
char *dm_strdup_aux(const char *str, const char *file, int line)
{
	char *ret;

	if (!str) {
		log_error("Internal error: dm_strdup called with NULL pointer");
		return NULL;
	}

	if ((ret = dm_malloc_aux_debug(strlen(str) + 1, file, line)))
		strcpy(ret, str);

	return ret;
}
Example #3
0
void *dm_realloc_aux(void *p, unsigned int s, const char *file, int line)
{
	void *r;
	struct memblock *mb = ((struct memblock *) p) - 1;

	r = dm_malloc_aux_debug(s, file, line);

	if (p) {
		memcpy(r, p, mb->length);
		dm_free_aux(p);
	}

	return r;
}