X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f Message-ID: <3C6D3462.61BFE42F@yahoo.com> From: CBFalconer Organization: Ched Research X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: Malloc/free DJGPP code References: <3C6C735D DOT A6D16719 AT yahoo DOT com> <1225-Fri15Feb2002084500+0200-eliz AT is DOT elta DOT co DOT il> <3C6CC93C DOT 6F9E05E6 AT yahoo DOT com> <2947-Fri15Feb2002112947+0200-eliz AT is DOT elta DOT co DOT il> <3C6CF755 DOT CC35209E AT yahoo DOT com> <7680-Fri15Feb2002142924+0200-eliz AT is DOT elta DOT co DOT il> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 40 Date: Fri, 15 Feb 2002 16:32:41 GMT NNTP-Posting-Host: 12.90.174.64 X-Complaints-To: abuse AT worldnet DOT att DOT net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1013790761 12.90.174.64 (Fri, 15 Feb 2002 16:32:41 GMT) NNTP-Posting-Date: Fri, 15 Feb 2002 16:32:41 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Eli Zaretskii wrote: > > > From: CBFalconer > > Newsgroups: comp.os.msdos.djgpp > > Date: Fri, 15 Feb 2002 11:58:27 GMT > > > > But that doesn't explain why the static 'firstime' control failed? > > I think it failed because malloc is called from the startup code more > than once. So the condition guarded the very first call, but not the > others. That doesn't hang together, because the version with no \r spat out confused output, but I could tell from it that there was only one call to sbrk involved. For testing the writing I am using a very small test sample, so that no further blocks need be assigned. Note that the enabled debuggery ONLY fires when malloc needs a new block, and not on further calls to malloc. > > > The file system to receive 'write' has no more reason to be > > initialized at that point than does cprintf, does it? > > The call to `write' doesn't need any initializations, assuming you > write to handles 1 or 2, which are already preconnected when the > program starts. `write' is more or less straightforward path to a DOS > call (you can use `_write' if you want to be even closer to the DOS > call, but in that case, you will need to use "\r\n" to end a line). What is the relationship of file handle numbers to destinations? I assume 1 and 2 correspond to stdin and stderr in some order? Haven't dug into DOS at that level for 10 years or more. -- Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT XXXXworldnet DOT att DOT net) Available for consulting/temporary embedded and systems. (Remove "XXXX" from reply address. yahoo works unmodified) mailto:uce AT ftc DOT gov (for spambots to harvest)