curl-library
Re: proposal: curl_easy_setopt should copy argument strings
Date: Sun, 26 May 2002 15:32:33 +0200 (MET DST)
On Sun, 26 May 2002, Vladimir Tsichevski wrote:
> Perusing the libcurl sources I noticed that curl_easy_setopt just stores
> the pointers to its char* arguments. So everyone who uses that procedure
> should maintain the storage for that strings.
Yes, that has been the case since day one and is also documented in the
curl_easy_setopt man page. Shouldn't come as a surprise! ;-)
> Had curl_easy_setopt() copy the strings with strdup() would solve that
> problem.
Is this really a problem?
I made it this way deliberately from the beginning, as it makes libcurl do
less malloc()/free() operations. In many cases they won't be needed, since
the application will have the data kept around anyway. By giving the
application the responsibility, we get the lowest possible number of malloc()
calls.
But I'm open for listening to other persons' opinions on this issue.
-- Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/ _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfmReceived on 2002-05-26