Re: [PATCH 3/4] imap_send: setup_curl: use server_conf parameter instead of the global variable
- From
Nicolas Morey-Chaisemartin <nicolas@morey-chaisemartin.com>
- Date
- Aug 7, 2017, 17:06 UTC
- Message-ID
- <71817815-4e52-4623-b226-bbb57ca08047@morey-chaisemartin.com>
- In-Reply-To
- <CAN0heSqyiisjWyDBXLJcyx=Hh3NA562DoFqP8rpFyi_zuGKLEA@mail.gmail.com>
Le 07/08/2017 à 18:34, Martin Ågren a écrit :
Show 32 quoted lines
> On 7 August 2017 at 16:04, Nicolas Morey-Chaisemartin
> <nicolas@morey-chaisemartin.com> wrote:
>> Signed-off-by: Nicolas Morey-Chaisemartin <nicolas@morey-chaisemartin.com>
>> ---
>> imap-send.c | 24 ++++++++++++------------
>> 1 file changed, 12 insertions(+), 12 deletions(-)
>>
>> diff --git a/imap-send.c b/imap-send.c
>> index 682a06551..90b8683ed 100644
>> --- a/imap-send.c
>> +++ b/imap-send.c
>> @@ -1415,37 +1415,37 @@ static CURL *setup_curl(struct imap_server_conf *srvc)
>> if (!curl)
>> die("curl_easy_init failed");
>>
>> - server_fill_credential(&server);
>> - curl_easy_setopt(curl, CURLOPT_USERNAME, server.user);
>> - curl_easy_setopt(curl, CURLOPT_PASSWORD, server.pass);
>> + server_fill_credential(srvc);
>> + curl_easy_setopt(curl, CURLOPT_USERNAME, srvc->user);
>> + curl_easy_setopt(curl, CURLOPT_PASSWORD, srvc->pass);
> Here you change the server_fill_credential-call that you just added.
> Maybe do this patch earlier, perhaps even as patch 1?
>
> I'm snipping lots of s/server/srvc/-changes... There's a less noisy
> way of addressing the fact that srvc is unused: dropping it. I'm not
> saying that's a good idea, but it could be considered, then explained
> why this approach is better. There are some other functions which
> access "server" directly, and some which take (and use!) a "srvc".
> Maybe make the whole file consistent?
>
> MartinThat's why I applied it after #2. I was not sure if this one made sense or not. And it can be dropped with the rest of the series still applying. I don't know what is the right approach here. Someone with more knowledge of why there is a mix of global variable and local can maybe help ?
Nicolas