From 5db3556f0bef599c8424bf8cb957567b8fe56c51 Mon Sep 17 00:00:00 2001 From: Nikolay Shirokovskiy <nshirokovskiy@tarantool.org> Date: Fri, 7 Jul 2023 11:20:14 +0300 Subject: [PATCH] salad: get rid of core memory dependency We are going to include generated small_config.h into small allocator headers (currently it is only included in small source files). core/memory.h depends on small headers and salad/heap.h depends on core/memory.h. As a result we need to provide a way for salad/heap.h users to find small_config.h header. Instead let's drop dependency from core/memory.h as we only use it for typeof definition. Part of #7327 NO_CHANGELOG=code cleanup NO_DOC=code cleanup (cherry picked from commit d01609a475a4e633ef98ee8889be9c4c59bd43d1) --- src/lib/salad/heap.h | 5 ++++- test/unit/heap_iterator.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib/salad/heap.h b/src/lib/salad/heap.h index 31750216aa..d7be50b416 100644 --- a/src/lib/salad/heap.h +++ b/src/lib/salad/heap.h @@ -37,7 +37,6 @@ #include <stdint.h> #include <stdbool.h> #include <assert.h> -#include <memory.h> /** * Additional user defined name that appended to prefix 'heap' @@ -176,6 +175,10 @@ struct heap_iterator { #ifndef HEAP_FORWARD_DECLARATION +#ifndef typeof +#define typeof __typeof__ +#endif + #ifndef container_of #define container_of(ptr, type, member) ({ \ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ diff --git a/test/unit/heap_iterator.c b/test/unit/heap_iterator.c index 3fceffff3b..a6411740f5 100644 --- a/test/unit/heap_iterator.c +++ b/test/unit/heap_iterator.c @@ -2,7 +2,7 @@ #include <limits.h> #include <stdio.h> #include <stdbool.h> -#include <memory.h> +#include <string.h> #include "unit.h" -- GitLab