Skip to content

Commit 1be72c9

Browse files
blinoaperezdc
authored andcommitted
Fix build failure due to libc functions used in old glibc and libc++ headers
glibc < 2.26 uses calloc and malloc for the str(n)dup macros in bits/string2.h, included by string.h libc++ cstdlib header can also use ::malloc, ::realloc, ::calloc and ::free Fixes: 159851d ("Wrap memory allocation functions to abort on failure") Fixes: d77bc02 ("Fix build failure due to libc++ using libc functions")
1 parent 74673eb commit 1be72c9

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/loader.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@
2626

2727
#include "loader-private.h"
2828

29-
#include "alloc-private.h"
3029
#include <dlfcn.h>
3130
#include <stdio.h>
3231
#include <string.h>
3332

33+
#include "alloc-private.h"
34+
3435
static void* s_impl_library = 0;
3536
static struct wpe_loader_interface* s_impl_loader = 0;
3637

src/pasteboard-generic.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828

2929
#include <map>
3030
#include <string>
31+
#include <cstring>
3132

3233
// We need to include this header last, in order to avoid template expansions
3334
// from the C++ standard library happening after it forbids usage of the libc
3435
// memory functions.
3536
#include "alloc-private.h"
36-
#include <cstring>
3737

3838
namespace Generic {
3939
using Pasteboard = std::map<std::string, std::string>;

src/pasteboard.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@
2626

2727
#include "pasteboard-private.h"
2828

29-
#include "alloc-private.h"
3029
#include "loader-private.h"
3130
#include <stdlib.h>
3231
#include <string.h>
3332

33+
#include "alloc-private.h"
34+
3435
void
3536
wpe_pasteboard_string_initialize(struct wpe_pasteboard_string* string, const char* in_string, uint64_t in_length)
3637
{

0 commit comments

Comments
 (0)