mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-08 22:45:43 +00:00
94 lines
3.4 KiB
Diff
94 lines
3.4 KiB
Diff
|
--- lib/core/include/internal/pool_allocator.h.orig 2020-02-19 02:55:20.000000000 -0700
|
||
|
+++ lib/core/include/internal/pool_allocator.h 2020-02-19 20:30:07.385673716 -0700
|
||
|
@@ -33,15 +33,15 @@ namespace pm {
|
||
|
class allocator : public PM_ALLOCATOR_BASE<char> {
|
||
|
using base_t = PM_ALLOCATOR_BASE<char>;
|
||
|
public:
|
||
|
- void* allocate(size_t n)
|
||
|
+ void* allocate(std::size_t n)
|
||
|
{
|
||
|
return base_t::allocate(n, nullptr);
|
||
|
}
|
||
|
- void deallocate(void* p, size_t n)
|
||
|
+ void deallocate(void* p, std::size_t n)
|
||
|
{
|
||
|
base_t::deallocate(reinterpret_cast<char*>(p), n);
|
||
|
}
|
||
|
- void* reallocate(void* p, size_t old_sz, size_t new_sz);
|
||
|
+ void* reallocate(void* p, std::size_t old_sz, std::size_t new_sz);
|
||
|
|
||
|
template <typename Data, typename... Args>
|
||
|
Data* construct(Args&&... args)
|
||
|
--- lib/core/src/lib_init.cc.orig 2020-02-19 02:55:20.000000000 -0700
|
||
|
+++ lib/core/src/lib_init.cc 2020-02-19 20:30:07.386673716 -0700
|
||
|
@@ -17,6 +17,7 @@
|
||
|
|
||
|
#include "polymake/internal/pool_allocator.h"
|
||
|
|
||
|
+#include <cstddef>
|
||
|
#include <cstring>
|
||
|
#include <memory>
|
||
|
#include <cstdlib>
|
||
|
@@ -24,7 +25,7 @@
|
||
|
#include <gmp.h>
|
||
|
|
||
|
extern "C" {
|
||
|
- void* __gmp_default_allocate(size_t);
|
||
|
+ void* __gmp_default_allocate(std::size_t);
|
||
|
}
|
||
|
|
||
|
namespace pm {
|
||
|
@@ -36,19 +37,19 @@ namespace {
|
||
|
|
||
|
class pool_allocator_constants : public __gnu_cxx::__pool_alloc_base {
|
||
|
public:
|
||
|
- static constexpr size_t align = _S_align, limit = _S_max_bytes;
|
||
|
+ static constexpr std::size_t align = _S_align, limit = _S_max_bytes;
|
||
|
};
|
||
|
|
||
|
}
|
||
|
|
||
|
-void* pm::allocator::reallocate(void* p, size_t old_sz, size_t new_sz)
|
||
|
+void* pm::allocator::reallocate(void* p, std::size_t old_sz, std::size_t new_sz)
|
||
|
{
|
||
|
if (!p) {
|
||
|
assert(old_sz == 0);
|
||
|
return allocate(new_sz);
|
||
|
}
|
||
|
static const bool use_new = getenv("GLIBCPP_FORCE_NEW") || getenv("GLIBCXX_FORCE_NEW");
|
||
|
- constexpr size_t align_mask = pool_allocator_constants::align-1;
|
||
|
+ constexpr std::size_t align_mask = pool_allocator_constants::align-1;
|
||
|
if (!use_new && ((old_sz+align_mask) & ~align_mask) == ((new_sz+align_mask) & ~align_mask) && new_sz < pool_allocator_constants::limit)
|
||
|
return p;
|
||
|
void* new_p = allocate(new_sz);
|
||
|
@@ -61,7 +62,7 @@ void* pm::allocator::reallocate(void* p,
|
||
|
|
||
|
#else // libc++
|
||
|
|
||
|
-void* pm::allocator::reallocate(void* p, size_t old_sz, size_t new_sz)
|
||
|
+void* pm::allocator::reallocate(void* p, std::size_t old_sz, std::size_t new_sz)
|
||
|
{
|
||
|
void* new_p = allocate(new_sz);
|
||
|
if (new_p) {
|
||
|
@@ -76,16 +77,16 @@ void* pm::allocator::reallocate(void* p,
|
||
|
namespace {
|
||
|
|
||
|
allocator gmp_allocator;
|
||
|
-void* pm_gmp_allocate(size_t n) { return gmp_allocator.allocate(n); }
|
||
|
-void pm_gmp_deallocate(void* p, size_t n) { gmp_allocator.deallocate(p, n); }
|
||
|
-void* pm_gmp_reallocate(void* p, size_t old_sz, size_t new_sz) { return gmp_allocator.reallocate(p, old_sz, new_sz); }
|
||
|
+void* pm_gmp_allocate(std::size_t n) { return gmp_allocator.allocate(n); }
|
||
|
+void pm_gmp_deallocate(void* p, std::size_t n) { gmp_allocator.deallocate(p, n); }
|
||
|
+void* pm_gmp_reallocate(void* p, std::size_t old_sz, std::size_t new_sz) { return gmp_allocator.reallocate(p, old_sz, new_sz); }
|
||
|
|
||
|
void init_gmp_memory_management() __attribute__((constructor));
|
||
|
|
||
|
void init_gmp_memory_management()
|
||
|
{
|
||
|
// switch to custom GMP allocators only if no other component did it before
|
||
|
- typedef void* (*alloc_t)(size_t);
|
||
|
+ typedef void* (*alloc_t)(std::size_t);
|
||
|
alloc_t was_alloc;
|
||
|
mp_get_memory_functions(&was_alloc, nullptr, nullptr);
|
||
|
if (was_alloc == &__gmp_default_allocate)
|