From 10aecd64481eeff3ba63cf096d7d18f105b2dff7 Mon Sep 17 00:00:00 2001 From: Ilya Verbin <iverbin@tarantool.org> Date: Thu, 10 Oct 2024 20:29:25 +0300 Subject: [PATCH] Revert "hotfix: change aligned_alloc to posix_memalign" This reverts commit 3c25c667352ec4f9c733c514a1b8c15264c6ad88. `aligned_alloc()` is supported by macOS since 10.15. I believe that we do not support older versions now. NO_DOC=internal NO_TEST=internal NO_CHANGELOG=internal (cherry picked from commit 2f4594f748cff99d15f8f6d603797a308793de86) --- src/box/relay.cc | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/box/relay.cc b/src/box/relay.cc index a9943711e5..5b1967d391 100644 --- a/src/box/relay.cc +++ b/src/box/relay.cc @@ -31,7 +31,6 @@ #include "relay.h" #include "trivia/config.h" -#include "trivia/util.h" /** static_assert */ #include "tt_static.h" #include "scoped_guard.h" #include "cbus.h" @@ -59,8 +58,6 @@ #include "raft.h" #include "box.h" -#include <stdlib.h> - /** * Cbus message to send status updates from relay to tx thread. */ @@ -289,21 +286,13 @@ relay_new(struct replica *replica) * (Use clang UB Sanitizer, to make sure of this) */ assert((sizeof(struct relay) % alignof(struct relay)) == 0); - /* - * According to posix_memalign requirements, align must be - * multiple of sizeof(void *). - */ - static_assert(alignof(struct relay) % sizeof(void *) == 0, - "align for posix_memalign function must be " - "multiple of sizeof(void *)"); - struct relay *relay = NULL; - if (posix_memalign((void **)&relay, alignof(struct relay), - sizeof(struct relay)) != 0) { + struct relay *relay = (struct relay *) + aligned_alloc(alignof(struct relay), sizeof(struct relay)); + if (relay == NULL) { diag_set(OutOfMemory, sizeof(struct relay), "aligned_alloc", "struct relay"); return NULL; } - assert(relay != NULL); memset(relay, 0, sizeof(struct relay)); relay->replica = replica; -- GitLab