diff --git a/build_files/cmake/have_features.cmake b/build_files/cmake/have_features.cmake index de90d7fcdd2..c6bb0884a8c 100644 --- a/build_files/cmake/have_features.cmake +++ b/build_files/cmake/have_features.cmake @@ -8,7 +8,7 @@ include(CheckSymbolExists) -# Used for: `intern/guardedalloc/intern/mallocn_intern.h`. +# Used for: `intern/guardedalloc/intern/mallocn_intern.hh`. # Function `malloc_stats` is only available on GLIBC, # so check that before defining `HAVE_MALLOC_STATS`. check_symbol_exists(malloc_stats "malloc.h" HAVE_MALLOC_STATS_H) diff --git a/intern/guardedalloc/CMakeLists.txt b/intern/guardedalloc/CMakeLists.txt index b2db54c0e6e..d622adab486 100644 --- a/intern/guardedalloc/CMakeLists.txt +++ b/intern/guardedalloc/CMakeLists.txt @@ -26,8 +26,8 @@ set(SRC ./intern/memory_usage.cc MEM_guardedalloc.h - ./intern/mallocn_inline.h - ./intern/mallocn_intern.h + ./intern/mallocn_inline.hh + ./intern/mallocn_intern.hh # only so the header is known by cmake ../atomic/atomic_ops.h diff --git a/intern/guardedalloc/intern/leak_detector.cc b/intern/guardedalloc/intern/leak_detector.cc index 091b5dffe2e..f4895d182ca 100644 --- a/intern/guardedalloc/intern/leak_detector.cc +++ b/intern/guardedalloc/intern/leak_detector.cc @@ -10,7 +10,7 @@ #include #include "MEM_guardedalloc.h" -#include "mallocn_intern.h" +#include "mallocn_intern.hh" bool leak_detector_has_run = false; char free_after_leak_detection_message[] = diff --git a/intern/guardedalloc/intern/mallocn.cc b/intern/guardedalloc/intern/mallocn.cc index 7fcd708f45c..a331d39b658 100644 --- a/intern/guardedalloc/intern/mallocn.cc +++ b/intern/guardedalloc/intern/mallocn.cc @@ -15,7 +15,7 @@ #include -#include "mallocn_intern.h" +#include "mallocn_intern.hh" #ifdef WITH_JEMALLOC_CONF /** diff --git a/intern/guardedalloc/intern/mallocn_guarded_impl.cc b/intern/guardedalloc/intern/mallocn_guarded_impl.cc index 6cb93544772..74ab255adef 100644 --- a/intern/guardedalloc/intern/mallocn_guarded_impl.cc +++ b/intern/guardedalloc/intern/mallocn_guarded_impl.cc @@ -29,7 +29,7 @@ #include "../../source/blender/blenlib/BLI_strict_flags.h" #include "atomic_ops.h" -#include "mallocn_intern.h" +#include "mallocn_intern.hh" /* Only for debugging: * store original buffer's name when doing MEM_dupallocN diff --git a/intern/guardedalloc/intern/mallocn_inline.h b/intern/guardedalloc/intern/mallocn_inline.hh similarity index 85% rename from intern/guardedalloc/intern/mallocn_inline.h rename to intern/guardedalloc/intern/mallocn_inline.hh index 9ecbc3d03e9..27abaee4b32 100644 --- a/intern/guardedalloc/intern/mallocn_inline.h +++ b/intern/guardedalloc/intern/mallocn_inline.hh @@ -3,18 +3,12 @@ * SPDX-FileCopyrightText: 2009-2017 Facebook, Inc. All rights reserved. * * SPDX-License-Identifier: BSD-2-Clause */ +#pragma once /** \file * \ingroup intern_mem */ -#ifndef __MALLOCN_INLINE_H__ -#define __MALLOCN_INLINE_H__ - -#ifdef __cplusplus -extern "C" { -#endif - MEM_INLINE bool MEM_size_safe_multiply(size_t a, size_t b, size_t *result) { /* A size_t with its high-half bits all set to 1. */ @@ -33,9 +27,3 @@ MEM_INLINE bool MEM_size_safe_multiply(size_t a, size_t b, size_t *result) */ return ((high_bits & (a | b)) == 0 || (*result / b == a)); } - -#ifdef __cplusplus -} -#endif - -#endif /* __MALLOCN_INLINE_H__ */ diff --git a/intern/guardedalloc/intern/mallocn_intern.h b/intern/guardedalloc/intern/mallocn_intern.hh similarity index 97% rename from intern/guardedalloc/intern/mallocn_intern.h rename to intern/guardedalloc/intern/mallocn_intern.hh index 32e31aafb29..92ff8d0f8dc 100644 --- a/intern/guardedalloc/intern/mallocn_intern.h +++ b/intern/guardedalloc/intern/mallocn_intern.hh @@ -1,14 +1,12 @@ /* SPDX-FileCopyrightText: 2013 Blender Authors * * SPDX-License-Identifier: GPL-2.0-or-later */ +#pragma once /** \file * \ingroup intern_mem */ -#ifndef __MALLOCN_INTERN_H__ -#define __MALLOCN_INTERN_H__ - #ifdef __GNUC__ # define UNUSED(x) UNUSED_##x __attribute__((__unused__)) #elif defined(_MSC_VER) @@ -95,11 +93,7 @@ size_t malloc_usable_size(void *ptr); /* Real pointer returned by the malloc or aligned_alloc. */ #define MEMHEAD_REAL_PTR(memh) ((char *)memh - MEMHEAD_ALIGN_PADDING(memh->alignment)) -#include "mallocn_inline.h" - -#ifdef __cplusplus -extern "C" { -#endif +#include "mallocn_inline.hh" #define ALIGNED_MALLOC_MINIMUM_ALIGNMENT sizeof(void *) @@ -227,9 +221,3 @@ void mem_guarded_clearmemlist(void); const char *MEM_guarded_name_ptr(void *vmemh); void MEM_guarded_name_ptr_set(void *vmemh, const char *str); #endif - -#ifdef __cplusplus -} -#endif - -#endif /* __MALLOCN_INTERN_H__ */ diff --git a/intern/guardedalloc/intern/mallocn_lockfree_impl.cc b/intern/guardedalloc/intern/mallocn_lockfree_impl.cc index 571d08c4f97..e2197ab1d83 100644 --- a/intern/guardedalloc/intern/mallocn_lockfree_impl.cc +++ b/intern/guardedalloc/intern/mallocn_lockfree_impl.cc @@ -26,7 +26,7 @@ #include "../../source/blender/blenlib/BLI_strict_flags.h" #include "atomic_ops.h" -#include "mallocn_intern.h" +#include "mallocn_intern.hh" typedef struct MemHead { /* Length of allocated memory block. */ diff --git a/intern/guardedalloc/intern/memory_usage.cc b/intern/guardedalloc/intern/memory_usage.cc index a858613e715..ca7ad91d680 100644 --- a/intern/guardedalloc/intern/memory_usage.cc +++ b/intern/guardedalloc/intern/memory_usage.cc @@ -11,7 +11,7 @@ #include #include "MEM_guardedalloc.h" -#include "mallocn_intern.h" +#include "mallocn_intern.hh" #include "../../source/blender/blenlib/BLI_strict_flags.h"