Explorar el Código

No need to check ptr for NULL before searching the free list if the fixed lists are disabled.

Ioannis Koutras hace 14 años
padre
commit
84e4947ba2
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3 1
      src/custom_malloc.c

+ 3 - 1
src/custom_malloc.c

@@ -70,11 +70,13 @@ void * custom_ahmalloc(allocator_t* allocator, heap_t* heap, size_t size) {
 
 #ifdef WITH_FIXED_LISTS
     ptr = search_on_fixed(heap, req_padding(size));
-#endif /* WITH_FIXED_LISTS */
 
     if(ptr == NULL) {
+#endif /* WITH_FIXED_LISTS */
        ptr = best_fit_on_freelist(heap, size);
+#ifdef WITH_FIXED_LISTS
     }
+#endif /* WITH_FIXED_LISTS */
 
     if(ptr != NULL) {