]> git.ipfire.org Git - thirdparty/git.git/commit
remote: use strvecs to store remote url/pushurl
authorJeff King <peff@peff.net>
Fri, 14 Jun 2024 10:28:01 +0000 (06:28 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 14 Jun 2024 16:34:38 +0000 (09:34 -0700)
commit8e804415fd3183f56ced0dcc168f8cb4aa790473
treed5a44014ca781a900782abe13218f3bfec2440ed
parent52595c155a66076020a42197c10a32086d7c4ada
remote: use strvecs to store remote url/pushurl

Now that the url/pushurl fields of "struct remote" own their strings, we
can switch from bare arrays to strvecs. This has a few advantages:

  - push/clear are now one-liners

  - likewise the free+assigns in alias_all_urls() can use
    strvec_replace()

  - we now use size_t for storage, avoiding possible overflow

  - this will enable some further cleanups in future patches

There's quite a bit of fallout in the code that reads these fields, as
it tends to access these arrays directly. But it's mostly a mechanical
replacement of "url_nr" with "url.nr", and "url[i]" with "url.v[i]",
with a few variations (e.g. "*url" could become "*url.v", but I used
"url.v[0]" for consistency).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/archive.c
builtin/clone.c
builtin/ls-remote.c
builtin/push.c
builtin/remote.c
remote-curl.c
remote.c
remote.h
t/helper/test-bundle-uri.c
transport.c