Re: linux-ipsec: apps/utils/libs that parse IP/netbits > > ...the attractions of avoiding malloc() are
Sigh, you're right. Fortunately, the worst difficulty with using malloc
has now been bypassed, because breaking the code up into smaller chunks
has separated atoaddr (the problem area) from addrtoa (which needs to be
available within the kernel). So use of malloc to cover the overflow case
in atoaddr is now back in. (It does use the fixed buffer for things that
will fit, which essentially eliminates any performance hit, since most any
real name will.)
> If you're really concerned about malloc, use alloca() or a dynamically
> sized char array (which gcc supports).
Using those within the kernel could get even trickier. I know the kernel
has a malloc analog, although its interface isn't quite the same, but
alloca is an awkward kludge even in user code.
Henry Spencer
henry@spsystems.net
(henry@zoo.toronto.edu)
Received on Wed Jul 22 12:08:30 1998
This archive was generated by hypermail 2.1.8
: Wed Aug 23 2006 - 12:59:24 EDT
|