Re: [PATCH 09/15] service: Leverage 'service_set_proxy_method'.

Grant Erickson <[email protected]> Tue, 4 Mar 2025 11:09:24 -0800
Newsgroups dev.linux.lists.connman
Message-ID <[email protected]>
On Mar 4, 2025, at 9:12 AM, Denis Kenzior <[email protected]> wrote:
> On 2/21/25 9:56 AM, Grant Erickson wrote:
>> +void __connman_service_set_proxy_autoconfig(struct connman_service *service,
>> + const char *url)
>> +{
>> + const bool dochanged = true;
>> + const bool donotifier = true;
>> + const void *context = url;
> 
> Why are these needed?

As always, I have a preference / habit of making code self-documenting wherever possible. So, rather than seeing “true, true” in the parameter list and then having to run through the code to figure out what those are / mean, it’s self-documented.

The ‘url’ one was not strictly necessary but it was “parallel construction” with the other two.

>>  - __connman_notifier_proxy_changed(service);
>> + DBG("service %p (%s) url %p (%s)",
>> + service,
>> + connman_service_get_identifier(service),
>> + url,
>> + url ? url : "<null>");
>> +
>> + service_set_pac(service, url, !dochanged);
>> +
>> + service_set_proxy_method(service,
>> + CONNMAN_SERVICE_PROXY_METHOD_AUTO,
>> + donotifier,
>> + service_set_proxy_method_auto_handler,
>> + context);
> 
> Conversion from any pointer type to void * is automatic in C; using 'url' would be just fine here?

Confirmed; see above.

Best,

Grant

-- 
Principal
Nuovations

[email protected]
https://www.nuovations.com/