This month's Index
Subject: Re: Use of malloc/free in c-ares
Re: Use of malloc/free in c-ares
From: Daniel Stenberg <daniel_at_haxx.se>
On Tue, 8 Mar 2005 email@example.com wrote:
> Now, is that strdup (essentially a malloc/strcpy) really necessary? In the
Yes, it would work and be a lot faster. But we cannot assume C99 since we want
> And for the non-C99 world, wouldn't this be a good use for alloca()?
Sure, but alloca() is not a standard function so there will be systems with
> If the C99 method is available, it uses that, if not it falls back to
Can you write the code that way and it still looks pretty and readable?
> But since gcc supports the C99 method and MSVC supports alloca (well
Another alternative is to simply allocate space for it on the stack for the
... unless it can be very big.
> I'd guess that there are quite a few places where such mallocs could be
Is it really? If so, we should rather first figure out if this really is the
-- -=- Daniel Stenberg -=- http://daniel.haxx.se -=- ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol _______________________________________________ http://cool.haxx.se/mailman/listinfo/c-aresReceived on Tue Mar 8 14:26:54 2005