]> git.ipfire.org Git - thirdparty/curl.git/commit
urlapi: leaner with fewer allocs
authorDaniel Stenberg <daniel@haxx.se>
Thu, 1 Sep 2022 08:16:24 +0000 (10:16 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 7 Sep 2022 08:21:45 +0000 (10:21 +0200)
commitf703cf971ccdb93fea05f223cabbb99ca06cdc75
treefae9b603ebdc5cb79dc6aaed3b49e8744cd57969
parent2ae81e680b8d6f8b9eb36fd1a2e223783526dbdd
urlapi: leaner with fewer allocs

Slightly faster with more robust code. Uses fewer and smaller mallocs.

- remove two fields from the URL handle struct
- reduce copies and allocs
- use dynbuf buffers more instead of custom malloc + copies
- uses dynbuf to build the host name in reduces serial alloc+free within
  the same function.
- move dedotdotify into urlapi.c and make it static, not strdup the input
  and optimize it by checking for . and / before using strncmp
- remove a few strlen() calls
- add Curl_dyn_setlen() that can "trim" an existing dynbuf

Closes #9408
docs/DYNBUF.md
lib/Makefile.inc
lib/dotdot.c [deleted file]
lib/dotdot.h [deleted file]
lib/dynbuf.c
lib/dynbuf.h
lib/url.c
lib/urlapi-int.h
lib/urlapi.c
tests/unit/unit1395.c
tests/unit/unit1653.c