curl-library
Re: Duplicated initialization in singlesocket?
Date: Sun, 3 Jan 2010 12:48:47 +0100
On Sunday 03 of January 2010 02:12:46 Julien Chaffraix wrote:
> memset(&socks, 0, sizeof(socks));
> for(i=0; i< MAX_SOCKSPEREASYHANDLE; i++)
> socks[i] = CURL_SOCKET_BAD;
I think this may be cruft left over from revision 1.118 when it seemed
like this:
memset(¤t, 0, sizeof(current));
for(i=0; i< MAX_SOCKSPEREASYHANDLE; i++)
current.socks[i] = CURL_SOCKET_BAD;
> My understanding is that the memset does not initialize more than the
> for loop, which means that it could be dropped - looking at the code
> there is no use of memset with negative values so I guess there may be
> some portability issues with using memset(&socks, CURL_SOCKET_BAD,
> sizeof(socks)). Is my analysis correct?
I think so. The call of memset may be safely removed without any change
of behavior, right?
Kamil
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-01-03