Parcourir la source

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

Ioannis Koutras il y a 13 ans
Parent
commit
84e4947ba2
1 fichiers modifiés avec 3 ajouts et 1 suppressions
  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) {