blob: e844bf9b7d890c26aea2e7327abd69e5eae5eb26 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
From f01a1ae37d3e502a900b5a6cfa5be217003cf7d4 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Aug 2025 21:46:26 -0700
Subject: [PATCH] Add missing include for malloc/free
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
include/fmt/format.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/fmt/format.h b/include/fmt/format.h
index 287e7163..0412812f 100644
--- a/include/fmt/format.h
+++ b/include/fmt/format.h
@@ -44,6 +44,7 @@
# include <cmath> // std::signbit
# include <cstddef> // std::byte
# include <cstdint> // uint32_t
+# include <cstdlib> // std::malloc, std::free
# include <cstring> // std::memcpy
# include <limits> // std::numeric_limits
# include <new> // std::bad_alloc
@@ -744,12 +745,12 @@ template <typename T> struct allocator {
T* allocate(size_t n) {
FMT_ASSERT(n <= max_value<size_t>() / sizeof(T), "");
- T* p = static_cast<T*>(malloc(n * sizeof(T)));
+ T* p = static_cast<T*>(std::malloc(n * sizeof(T)));
if (!p) FMT_THROW(std::bad_alloc());
return p;
}
- void deallocate(T* p, size_t) { free(p); }
+ void deallocate(T* p, size_t) { std::free(p); }
};
} // namespace detail
|