static void * INLINE Init(struct Data *scr, /* stack oriented */ long *cmdline) /* command line info */ { ReturnCode ret; uchar *buffer; struct Data *ptr; memset(scr, 0, sizeof(struct Data)); /* NULLs everything! */ /* * Set some flags according to command line parameters: */ if(cmdline[LINE_COMMENTNEST] ) { scr->flags |= FPLDATA_NESTED_COMMENTS; } buffer=(uchar *)MALLOCA(BUF_SIZE); if(!buffer) /* fail! */ return(NULL); scr->buf=buffer; scr->cmdline = cmdline; if(ret=InitHash(scr)) return(NULL); ptr=(struct Data *)MALLOCA(sizeof(struct Data)); if(ptr) *ptr=*scr; /* copy the entire structure! */ IdentNumber=0; /* identifier number to increase at every declaration */ return((void *)ptr); }
void* aMallocA_(size_t size, const char *file, int line, const char *func) { void *ret = MALLOCA(size, file, line, func); // ShowMessage("%s:%d: in func %s: aMallocA %d\n",file,line,func,size); if (ret == NULL){ ShowFatalError("%s:%d: in func %s: aMallocA error out of memory!\n",file,line,func); exit(1); } return ret; }
void* aMallocA_ (size_t size, const char *file, int line, const char *func) { #ifndef MEMWATCH void *ret = MALLOCA(size); #else void *ret = mwMalloc(size, file, line); #endif // ShowMessage("%s:%d: in func %s: malloc %d\n",file,line,func,size); if (ret == NULL){ ShowFatalError("%s:%d: na funcao %s: erro de malocacao, despejo de memoria!\n",file,line,func); exit(1); } return ret; }
void* _bcallocA(size_t size, size_t cnt) { void *ret = MALLOCA(size * cnt); if (ret) memset(ret, 0, size * cnt); return ret; }