On Mon, 14 Feb 2022, Henrik Holst wrote:

So first ".curlrc" is strlen:ed and then 7 calls to alloc_addbyter() which is the exact length of ".curlrc" so it looks like some function goes over strings one byte at a time and adds them to a dynamic buffer one by one. Perhaps this is done to exclude invalid characters or something?

I believe it is the curl_maprintf() function, probably the one called from src/tool_findfile.c that builds paths to use when checking for .curlrc in various places.

alloc_addbyter() could most likely be optimized to do a single write to the buffer instead of calling memcpy() by way of Curl_dyn_addn(buf, out, 1)

I'm sure it can, but it will take some interesting massaging of the *printf() code to get done. I don't think it's a low hanging fruit.

--

 / daniel.haxx.se
 | Commercial curl support up to 24x7 is available!
 | Private help, bug fixes, support, ports, new features
 | https://curl.se/support.html
--
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Reply via email to