delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/03/02/12:43:37

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f
From: Martin Str|mberg <ams AT ludd DOT luth DOT se>
Message-Id: <200203021743.SAA04889@father.ludd.luth.se>
Subject: Re: Malloc/free DJGPP code
In-Reply-To: <10203021633.AA16645@clio.rice.edu> from Charles Sandmann at "Mar 2, 2002 10:33:53 am"
To: djgpp-workers AT delorie DOT com
Date: Sat, 2 Mar 2002 18:43:31 +0100 (MET)
X-Mailer: ELM [version 2.4ME+ PL54 (25)]
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

According to Charles Sandmann:
> The patch Richard likes is the one which Eric Rudd tested.  I did light
> testing on both.

I'm trying to test it but it won't compile and I can't see what the
problem is:

cc1.exe: warnings being treated as errors
malloc.c: In function `malloc':
malloc.c:238: warning: cast does not match function type
make.exe[3]: *** [malloc.o] Error 1
make.exe[2]: *** [all_subs] Error 2
make.exe[1]: *** [all] Error 2
make.exe: *** [subs] Error 2

Everything I try just makes it worse.

The patch:

Index: djgpp//src/libc/ansi/stdlib/malloc.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdlib/malloc.c,v
retrieving revision 1.11
diff -p -u -r1.11 malloc.c
--- djgpp//src/libc/ansi/stdlib/malloc.c        2001/07/06 09:58:05
 1.11
+++ djgpp//src/libc/ansi/stdlib/malloc.c        2002/03/02 17:42:13
@@ -235,6 +235,8 @@ malloc(size_t size)
     b++;
   }

+  brk((void *)( ((int)sbrk(0)+(ALIGN-1)) & ~(ALIGN-1) )); /* Align next sbrk */
+
   chunk_size = size+16; /* two ends plus two placeholders */
   rv = (BLOCK *)sbrk(chunk_size);
   if (rv == (BLOCK *)(-1))


Right,

						MartinS

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019