INLINE void debugfree P1(void *, ptr)
{
    void *tmp;

    NOISY1("free (%x)\n", ptr);
    stats.free_calls++;
    tmp = (node_t *) ptr - 1;
    if (MDfree(tmp)) {
	FREE(tmp);		/* only free if safe to do so */
    }
}
Exemple #2
0
INLINE void debugfree (void * ptr)
{
    md_node_t *tmp;

    NOISY1("free (%x)\n", ptr);
    stats.free_calls++;
    tmp = (md_node_t *) ptr - 1;
    if (MDfree(tmp)) {
	memset(ptr, 'x', tmp->size);
	FREE(tmp);		/* only free if safe to do so */
    }
}
INLINE void *debugrealloc P4(void *, ptr, int, size, int, tag, char *, desc)
{
    void *tmp;

    NOISY3("realloc: %i (%x), %s\n", size, ptr, desc);
    stats.realloc_calls++;
    tmp = (node_t *) ptr - 1;
    if (MDfree(tmp)) {
	tmp = (void *) REALLOC(tmp, size + MD_OVERHEAD);
	MDmalloc(tmp, size, tag, desc);
	return (node_t *) tmp + 1;
    }
    return (void *) 0;
}
Exemple #4
0
INLINE void *debugrealloc (void * ptr, int size, int tag, char * desc)
{
    void *tmp;

    if (size <= 0)
	fatal("illegal size in debugrealloc()");

    NOISY3("realloc: %i (%x), %s\n", size, ptr, desc);
    stats.realloc_calls++;
    tmp = (md_node_t *) ptr - 1;
    if (MDfree(tmp)) {
	tmp = (void *) REALLOC(tmp, size + MD_OVERHEAD);
	MDmalloc(tmp, size, tag, desc);
	return (md_node_t *) tmp + 1;
    }
    return (void *) 0;
}