Skip to content

Commit 9a56957

Browse files
committed
Adapt to mintlib
1 parent dbf6408 commit 9a56957

File tree

8 files changed

+27
-248
lines changed

8 files changed

+27
-248
lines changed

mintlib/EXTRAFILES

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
SRCFILES += BINFILES EXTRAFILES MISCFILES Makefile SRCFILES SYSCALLS \
1111
_itoa.h math_private.h math_ldbl.h atomicity.h atomicity-68020.h errbase.h \
1212
gensys stksiz.h sysdep.h lib.h libc-symbols.h \
13-
machine-gmon.h memcopy.h profil-counter.h malloc_int.h \
13+
machine-gmon.h memcopy.h profil-counter.h \
1414
alpha.h punct.h \
1515
syscalls.h syscalls.list test-assert-perr.c test-assert.c test-atexit.c \
1616
test-atexit.expect test-ctype.c test-ctype1.c test-ctype1.expect \

mintlib/SRCFILES

-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ SRCFILES = \
1616
assert-perr.c \
1717
assert.c \
1818
buffindf.c \
19-
calloc.c \
2019
checkcpu.S \
2120
console.c \
2221
crtinit.c \
@@ -67,13 +66,11 @@ SRCFILES = \
6766
malloc.c \
6867
mcount.c \
6968
modf.S \
70-
posix_memalign.c \
7169
profil-freq.c \
7270
profil-posix.c \
7371
pselect.c \
7472
putenv.c \
7573
quickstat.c \
76-
realloc.c \
7774
regexp.c \
7875
regsup.c \
7976
rtent.c \
@@ -108,7 +105,6 @@ SRCFILES = \
108105
uidgid.c \
109106
unixtime.c \
110107
unx2dos.c \
111-
valloc.c \
112108
wctrans.c \
113109
wctype.c \
114110
wcwidth.c \

mintlib/calloc.c

-25
This file was deleted.

mintlib/malloc.c

+26-9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
#define HAVE_MMAP 0
2+
#define MMAP_CLEARS 0
3+
#define HAVE_MORECORE 1
4+
#define MORECORE_CONTIGUOUS 0
5+
#define NO_MALLOC_STATS 1
6+
#define malloc_getpagesize ((size_t)8192U)
7+
#define LACKS_TIME_H /* time(0) calls malloc... */
8+
19
/*
210
This is a version (aka dlmalloc) of malloc/free/realloc written by
311
Doug Lea and released to the public domain, as explained at
@@ -813,14 +821,14 @@ extern "C" {
813821
/* ------------------- Declarations of public routines ------------------- */
814822

815823
#ifndef USE_DL_PREFIX
816-
#define dlcalloc calloc
817-
#define dlfree free
818-
#define dlmalloc malloc
819-
#define dlmemalign memalign
820-
#define dlposix_memalign posix_memalign
821-
#define dlrealloc realloc
824+
#define dlcalloc __calloc
825+
#define dlfree __free
826+
#define dlmalloc __malloc
827+
#define dlmemalign __memalign
828+
#define dlposix_memalign __posix_memalign
829+
#define dlrealloc __realloc
822830
#define dlrealloc_in_place realloc_in_place
823-
#define dlvalloc valloc
831+
#define dlvalloc __valloc
824832
#define dlpvalloc pvalloc
825833
#define dlmallinfo mallinfo
826834
#define dlmallopt mallopt
@@ -996,7 +1004,7 @@ DLMALLOC_EXPORT size_t dlmalloc_max_footprint(void);
9961004
guarantee that this number of bytes can actually be obtained from
9971005
the system.
9981006
*/
999-
DLMALLOC_EXPORT size_t dlmalloc_footprint_limit();
1007+
DLMALLOC_EXPORT size_t dlmalloc_footprint_limit(void);
10001008

10011009
/*
10021010
malloc_set_footprint_limit();
@@ -4151,7 +4159,8 @@ static void* sys_alloc(mstate m, size_t nb) {
41514159
char* end = CMFAIL;
41524160
ACQUIRE_MALLOC_GLOBAL_LOCK();
41534161
br = (char*)(CALL_MORECORE(asize));
4154-
end = (char*)(CALL_MORECORE(0));
4162+
/* end = (char*)(CALL_MORECORE(0)); */
4163+
end = br + asize;
41554164
RELEASE_MALLOC_GLOBAL_LOCK();
41564165
if (br != CMFAIL && end != CMFAIL && br < end) {
41574166
size_t ssize = end - br;
@@ -6278,3 +6287,11 @@ int mspace_mallopt(int param_number, int value) {
62786287
structure of old version, but most details differ.)
62796288
62806289
*/
6290+
6291+
weak_alias (__calloc, calloc)
6292+
weak_alias(__free, free)
6293+
weak_alias(__malloc, malloc)
6294+
weak_alias (__memalign, memalign)
6295+
weak_alias(__posix_memalign, posix_memalign)
6296+
weak_alias (__realloc, realloc)
6297+
weak_alias (__valloc, valloc)

mintlib/malloc_int.h

-19
This file was deleted.

mintlib/posix_memalign.c

-80
This file was deleted.

mintlib/realloc.c

-97
This file was deleted.

mintlib/valloc.c

-13
This file was deleted.

0 commit comments

Comments
 (0)