This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Don't bind to registered ports in bindresvport
On 6/6/2012 10:26 PM, Mike Frysinger wrote:
> On Friday 01 June 2012 23:03:53 Carlos O'Donell wrote:
>> On Fri, Jun 1, 2012 at 4:01 PM, Dan Nicholson wrote:
>>> int nports = ENDPORT - startport + 1;
>>> int endport = ENDPORT;
>>> + bool_t chkport = TRUE;
>>> + struct servent serv;
>>> + char buf[1024];
>>
>> A global static buffer of this size should come from malloc (and get
>> allocated once).
>
> eh ? it's declared on the stack ... not sure what you mean about global or
> static. it's pretty much the same thing as calling alloca(1024).
> -mike
Sorry, that sentence came out as gibberish.
All I wanted to say was that we should think about alloca vs. malloc for
a 1kb buffer that we could reuse.
This has already led to a good discussion about policies for alloca.
Cheers,
Carlos.
--
Carlos O'Donell
Mentor Graphics / CodeSourcery
carlos_odonell@mentor.com
carlos@codesourcery.com
+1 (613) 963 1026