inline void free(void* ptr) { __free(ptr, __malloc_pool); #if DEBUG freed(ptr); #endif /* DEBUG */ }
static void wrap_realloc_pre(void *wrapctx, void **user_data) { logging_paused++; void *ptr = drwrap_get_arg(wrapctx, 0); freed(ptr); *user_data = drwrap_get_arg(wrapctx, 1); }
char *DMrealloc(char *ptr, int size, char *fname, int line) { char *saveptr; saveptr = ptr; ptr = DMmemcheck(ptr, fname, line); if ((ptr = (char *) realloc(ptr, size + HDRSIZE + 1)) == NULL) { fprintf(stderr, "%s[%d]: realloc(0x%x,%d) OUT OF MEMORY\n", fname, line, saveptr, size); abort(); } ptr = guardit(ptr, size); if (DMverbose || (DMtriggeraddr == ptr) || (DMtriggeraddr == saveptr)) { fprintf(stderr, "%s[%d]: realloc(0x%x,%d) = 0x%x\n", fname, line, saveptr, size, ptr); TRIGGER(saveptr); TRIGGER(ptr); } freed(saveptr, fname, line); malloced(ptr); return(ptr); }
inline void* realloc(void* ptr, size_t size) { void* ptr2 = __realloc(ptr, size, __malloc_pool); #if DEBUG freed(ptr); malloced(((void**)read_rbp())[1], size, ptr2); #endif /* DEBUG */ return ptr2; }
DMfree(char *ptr, char *fname, int line) { unsigned long size; if (ptr == NULL) return; if (DMverbose || (ptr == DMtriggeraddr)) { size = ((unsigned long *)ptr)[-2]; fprintf(stderr, "%s[%d]: free(0x%x) (%ld bytes)\n", fname, line, ptr, size); TRIGGER(ptr); } ptr = DMmemcheck(ptr, fname, line); /* Negate the last byte of the header guard to signify freed */ ((unsigned long *)ptr)[1] ^= 0x00ff; /* all's well so free it */ freed(ptr + HDRSIZE, fname, line); free(ptr); }
int execute_pipe(char *str) { char **put_in_sst; char ***temp; if (str) { put_in_sst = put_in_ss(str); if (put_in_sst) { temp = put_in_sss(put_in_sst); if (temp) { loop_pipe(temp); freed(temp); } ft_free2d(put_in_sst); } return (1); } else put_str(ANSI_COLOR_RED"str passed to pipe is 'NULL'"ANSI_COLOR_RESET); return (0); }
inline void G1BlockOffsetArray::freed(HeapWord* blk, size_t size) { freed(blk, blk + size); }
void globrearrange(long* numtrees,boolean* succeeded) { /* does global rearrangements */ tree globtree; tree oldtree; int i,j,k,num_sibs,num_sibs2; node *where,*sib_ptr,*sib_ptr2; double oldbestyet = curtree.likelihood; int success = false; alloctree(&globtree.nodep,nonodes2); alloctree(&oldtree.nodep,nonodes2); setuptree(&globtree,nonodes2); setuptree(&oldtree,nonodes2); allocd(nonodes2, globtree.nodep); allocd(nonodes2, oldtree.nodep); allocw(nonodes2, globtree.nodep); allocw(nonodes2, oldtree.nodep); copy_(&curtree,&globtree); copy_(&curtree,&oldtree); for ( i = spp ; i < nonodes2 ; i++ ) { num_sibs = count_sibs(curtree.nodep[i]); if(openloop)return; sib_ptr = curtree.nodep[i]; if ( (i - spp) % (( nonodes2 / 72 ) + 1 ) == 0 ) putchar('.'); fflush(stdout); for ( j = 0 ; j <= num_sibs ; j++ ) { re_move(&sib_ptr,&where); copy_(&curtree,&priortree); if (where->tip) { copy_(&oldtree,&curtree); copy_(&oldtree,&bestree); sib_ptr=sib_ptr->next; continue; } else { num_sibs2 = count_sibs(where); if(openloop)return; } sib_ptr2 = where; for ( k = 0 ; k < num_sibs2 ; k++ ) { addwhere = NULL; addtraverse(sib_ptr,sib_ptr2->back,true,numtrees,succeeded); if ( addwhere && where != addwhere && where->back != addwhere && bestree.likelihood > globtree.likelihood) { copy_(&bestree,&globtree); success = true; } sib_ptr2 = sib_ptr2->next; } copy_(&oldtree,&curtree); copy_(&oldtree,&bestree); sib_ptr = sib_ptr->next; } } copy_(&globtree,&curtree); copy_(&globtree,&bestree); if (success && globtree.likelihood > oldbestyet) { *succeeded = true; } else { *succeeded = false; } freed(nonodes2, globtree.nodep); freed(nonodes2, oldtree.nodep); freew(nonodes2, globtree.nodep); freew(nonodes2, oldtree.nodep); freetree(&globtree.nodep,nonodes2); freetree(&oldtree.nodep,nonodes2); }