void sc_free (int package, void *ptr) { if (ptr == NULL) { return; } else { /* uncount the allocations */ int *free_count = sc_free_count (package); #ifdef SC_ENABLE_PTHREAD sc_package_lock (package); #endif ++*free_count; #ifdef SC_ENABLE_PTHREAD sc_package_unlock (package); #endif } /* free memory */ #if defined SC_ENABLE_MEMALIGN sc_free_aligned (ptr, SC_MEMALIGN_BYTES); #else free (ptr); #endif }
void sc_free (int package, void *ptr) { if (ptr != NULL) { int *free_count = sc_free_count (package); ++*free_count; } free (ptr); }
void sc_free (int package, void *ptr) { if (ptr != NULL) { int *free_count = sc_free_count (package); ++*free_count; #ifdef SC_ALLOC_ALIGN ptr = (void *) ((size_t *) ptr)[-1]; SC_ASSERT (ptr != NULL); #endif } free (ptr); }
void sc_free (int package, void *ptr) { if (ptr != NULL) { int *free_count = sc_free_count (package); #ifdef SC_ENABLE_PTHREAD sc_package_lock (package); #endif ++*free_count; #ifdef SC_ENABLE_PTHREAD sc_package_unlock (package); #endif } free (ptr); }