src/tio_malloc.c
/*
 * Remove a freed block from the list.
 */
Remove a freed block from the list.
Remove a freed block from the list .
static void list_free(void *p)
{
  size_t i;
  if (NULL == p)  {
    return;
  }
  if (heap_error) {
    return;
  }
  if (disable) {
    return;
  }
  ++disable;
  for (i=0;i < heap_count;i++) {
    if (p == heap_list[i].p) {
      memuse -= heap_list[i].size;
      --memcount;
#ifdef _TYPHIO_MEMORY_DEBUG
      (void) strcpy(heap_list[i].subname, " ");
      heap_list[i].line = 0;
#endif
      heap_list[i].p    = NULL;
      heap_list[i].size = 0;
      ++heap_holes;
      break;
    }
  }
  --disable;
  if (0 == memcount) {
    free (heap_list);
    heap_list  = NULL;
    heap_count = 0;
    heap_limit = 0;
    heap_holes = 0;
  }
  return;
}
static void list_free ( void * p ) { size_t i ; if ( NULL == p ) { return ; } if ( heap_error ) { return ; } if ( disable ) { return ; } ++ disable ; for ( i = 0 ; i < heap_count ; i ++ ) { if ( p == heap_list [ i ] . p ) { memuse -= heap_list [ i ] . size ; -- memcount ; #ifdef _TYPHIO_MEMORY_DEBUG ( void ) strcpy ( heap_list [ i ] . subname , " " ) ; heap_list [ i ] . line = 0 ; #endif heap_list [ i ] . p = NULL ; heap_list [ i ] . size = 0 ; ++ heap_holes ; break ; } } -- disable ; if ( 0 == memcount ) { free ( heap_list ) ; heap_list = NULL ; heap_count = 0 ; heap_limit = 0 ; heap_holes = 0 ; } return ; }
Remove a freed block from the list.
Remove a freed block from the list .