mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 736963 - Move jemalloc'ed strdup/strndup definitions. r=jlebar,r=ted
This commit is contained in:
parent
9f1fbf3676
commit
31cd5a39fe
@ -80,6 +80,7 @@ endif
|
||||
|
||||
ifdef MOZ_MEMORY
|
||||
tier_base_dirs += memory/jemalloc
|
||||
tier_base_dirs += memory/build
|
||||
endif
|
||||
tier_base_dirs += \
|
||||
mozglue \
|
||||
|
@ -88,6 +88,7 @@ if [ ! "$LIBXUL_SDK" ]; then
|
||||
if [ "$MOZ_MEMORY" ]; then
|
||||
add_makefiles "
|
||||
memory/jemalloc/Makefile
|
||||
memory/build/Makefile
|
||||
"
|
||||
fi
|
||||
if [ "$MOZ_WIDGET_TOOLKIT" = "android" ]; then
|
||||
|
19
memory/build/Makefile.in
Normal file
19
memory/build/Makefile.in
Normal file
@ -0,0 +1,19 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = memory
|
||||
LIBRARY_NAME = memory
|
||||
FORCE_STATIC_LIB = 1
|
||||
STLFLAGS =
|
||||
|
||||
CSRCS = extraMallocFuncs.c
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
34
memory/build/extraMallocFuncs.c
Normal file
34
memory/build/extraMallocFuncs.c
Normal file
@ -0,0 +1,34 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <string.h>
|
||||
#include "mozilla/Types.h"
|
||||
|
||||
#ifdef ANDROID
|
||||
#define wrap(a) __wrap_ ## a
|
||||
#endif
|
||||
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX)
|
||||
#define wrap(a) je_ ## a
|
||||
#endif
|
||||
|
||||
#ifdef wrap
|
||||
void *wrap(malloc)(size_t);
|
||||
|
||||
MOZ_EXPORT_API(char *)
|
||||
wrap(strndup)(const char *src, size_t len)
|
||||
{
|
||||
char* dst = (char*) wrap(malloc)(len + 1);
|
||||
if (dst)
|
||||
strncpy(dst, src, len + 1);
|
||||
return dst;
|
||||
}
|
||||
|
||||
MOZ_EXPORT_API(char *)
|
||||
wrap(strdup)(const char *src)
|
||||
{
|
||||
size_t len = strlen(src);
|
||||
return wrap(strndup)(src, len);
|
||||
}
|
||||
#endif
|
@ -6216,22 +6216,6 @@ malloc_shutdown()
|
||||
#define realloc(a, b) wrap(realloc)(a, b)
|
||||
#define free(a) wrap(free)(a)
|
||||
#define malloc_usable_size(a) wrap(malloc_usable_size)(a)
|
||||
|
||||
void *malloc(size_t size);
|
||||
|
||||
char *
|
||||
wrap(strndup)(const char *src, size_t len) {
|
||||
char* dst = (char*) malloc(len + 1);
|
||||
if (dst)
|
||||
strncpy(dst, src, len + 1);
|
||||
return dst;
|
||||
}
|
||||
|
||||
char *
|
||||
wrap(strdup)(const char *src) {
|
||||
size_t len = strlen(src);
|
||||
return wrap(strndup)(src, len);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -48,7 +48,8 @@ LIBRARY_NAME = mozglue
|
||||
DIST_INSTALL = 1
|
||||
|
||||
ifdef MOZ_MEMORY
|
||||
SHARED_LIBRARY_LIBS = $(call EXPAND_LIBNAME_PATH,jemalloc,$(DEPTH)/memory/jemalloc)
|
||||
SHARED_LIBRARY_LIBS = $(call EXPAND_LIBNAME_PATH,memory,$(DEPTH)/memory/build)
|
||||
SHARED_LIBRARY_LIBS += $(call EXPAND_LIBNAME_PATH,jemalloc,$(DEPTH)/memory/jemalloc)
|
||||
else
|
||||
# Temporary, until bug 662814 lands
|
||||
VISIBILITY_FLAGS =
|
||||
|
Loading…
Reference in New Issue
Block a user