curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: a strlen update

From: Daniel Stenberg via curl-library <curl-library_at_lists.haxx.se>
Date: Mon, 14 Feb 2022 20:59:20 +0100 (CET)

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
Received on 2022-02-14