git/t/helper
Ævar Arnfjörð Bjarmason 99d60545f8 string-list API: change "nr" and "alloc" to "size_t"
Change the "nr" and "alloc" members of "struct string_list" to use
"size_t" instead of "nr". On some platforms the size of an "unsigned
int" will be smaller than a "size_t", e.g. a 32 bit unsigned v.s. 64
bit unsigned. As "struct string_list" is a generic API we use in a lot
of places this might cause overflows.

As one example: code in "refs.c" keeps track of the number of refs
with a "size_t", and auxiliary code in builtin/remote.c in
get_ref_states() appends those to a "struct string_list".

While we're at it split the "nr" and "alloc" in string-list.h across
two lines, which is the case for most such struct member
declarations (e.g. in "strbuf.h" and "strvec.h").

Changing e.g. "int i" to "size_t i" in run_and_feed_hook() isn't
strictly necessary, and there are a lot more cases where we'll use a
local "int", "unsigned int" etc. variable derived from the "nr" in the
"struct string_list". But in that case as well as
add_wrapped_shortlog_msg() in builtin/shortlog.c we need to adjust the
printf format referring to "nr" anyway, so let's also change the other
variables referring to it.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-07 12:02:04 -08:00
..
.gitignore
test-advise.c
test-bitmap.c
test-bloom.c
test-chmtime.c
test-config.c
test-crontab.c
test-csprng.c
test-ctype.c
test-date.c
test-delta.c
test-dir-iterator.c
test-drop-caches.c
test-dump-cache-tree.c
test-dump-fsmonitor.c
test-dump-split-index.c
test-dump-untracked-cache.c
test-example-decorate.c
test-fake-ssh.c
test-fast-rebase.c
test-genrandom.c
test-genzeros.c
test-getcwd.c
test-hash-speed.c
test-hash.c
test-hashmap.c
test-index-version.c
test-json-writer.c
test-lazy-init-name-hash.c
test-match-trees.c
test-mergesort.c
test-mktemp.c
test-oid-array.c
test-oidmap.c
test-oidtree.c
test-online-cpus.c
test-parse-options.c
test-parse-pathspec-file.c
test-partial-clone.c
test-path-utils.c
test-pcre2-config.c
test-pkt-line.c
test-prio-queue.c
test-proc-receive.c
test-progress.c
test-reach.c
test-read-cache.c
test-read-graph.c
test-read-midx.c
test-ref-store.c
test-reftable.c
test-regex.c
test-repository.c
test-revision-walking.c
test-run-command.c string-list API: change "nr" and "alloc" to "size_t" 2022-03-07 12:02:04 -08:00
test-scrap-cache-tree.c
test-serve-v2.c
test-sha1.c
test-sha1.sh
test-sha256.c
test-sigchain.c
test-simple-ipc.c
test-strcmp-offset.c
test-string-list.c
test-submodule-config.c
test-submodule-nested-repo-config.c
test-subprocess.c
test-tool.c
test-tool.h
test-trace2.c
test-urlmatch-normalization.c
test-userdiff.c
test-wildmatch.c
test-windows-named-pipe.c
test-write-cache.c
test-xml-encode.c