瀏覽代碼

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

Ioannis Koutras 13 年之前
父節點
當前提交
84e4947ba2
共有 1 個文件被更改,包括 3 次插入1 次删除
  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) {