cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Allocated curl_easy_setopt() strings

From: Robert Iakobashvili <coroberti_at_gmail.com>
Date: Sun, 29 Jul 2007 17:03:49 +0300

On 7/29/07, Daniel Stenberg <daniel_at_haxx.se> wrote:
>
> On Fri, 27 Jul 2007, Daniel Stenberg wrote:
>
> I mean like this (pseudo-code to display the concept in my mind):
>
> enum {
> STRING_PROXY,
> STRING_NETRC,
> ...
> }
>
> /* to extract a single string in the code, we get it from the array */
> char *netrc = data->set.strings[ enum ];
>
> /* and thus when we set this string in lib/url.c:Curl_setopt() we'd do:
> */
> result = Curl_setstropt(&data->set.strings[STRING_NETRC], ... );
>
> Since then we can use a simple loop in Curl_dupset(), and dupset would
> also
> automatically work without changes when we add more strings in the future.
>
> What do you (meaning everyone, not just Patrick) say?
>

Looks like the right thing to do. Worth to explain it in the code after
changes, like
"how-to add a new string".

-- 
Sincerely,
Robert Iakobashvili,
coroberti %x40 gmail %x2e com
...........................................................
http://curl-loader.sourceforge.net
A web testing and traffic generation tool.
Received on 2007-07-29