avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] fdevopen() uses calloc?


From: Joerg Wunsch
Subject: Re: [avr-gcc-list] fdevopen() uses calloc?
Date: Wed, 21 Jan 2004 16:06:36 +0100 (MET)

[Please do not followup to unrelated articles.  You've just made two
articles into an entirely different thread -- see the `References'
header.]

"J.C. Wren" <address@hidden> wrote:

> fdevopen() is using calloc(), which pulls in a lot of extra code.
> Is there any reason this couldn't use a static, instead?

It's been on my medium-priority todo list for some time to provide an
fdevopen() implementation that can handle only stdin/stdout/ stderr,
but has the struct __file for them pre-defined.

OTOH, it's probably of only limited use.  Anyone who's going to use
printf() is certainly running a larger device than an ATmega2313 ;-),
and perhaps is using malloc() already anyway.  Note that while it is
hard to replace fdevopen() itself in your application, it should be
trivial to replace malloc() and free() by your own versions.

> To write mine, I had to cheat and copy over stdio_private.h, which
> is a major hack.

I've seen a number of (ancient) Unix opensource tools that started to
depend on internals of struct __file, which in turn caused major
headaches when some system started to implement stdio in a different
manner.  I simply wanted to avoid this kind of upgrade nightmare, thus
I made struct __file a private entity.

I could provide a #define for the sizeof(struct __file) in <stdio.h>
if people found that to be useful.

-- 
J"org Wunsch                                           Unix support engineer
address@hidden        http://www.interface-systems.de/~j/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]