git-commit-vandalism/t/helper
Jeff King 7e6b96c73b test-read-cache: drop namelen variable
Early in the function we set "namelen = strlen(name)" if "name" is
non-NULL. Later, we use "namelen" only if "name" is non-NULL. However,
it's hard to immediately see this, and it seems to confuse gcc 9.2.1
(with "-flto" interestingly, though all of the involved logic is in
inline functions; it also triggers when building with ASan).

Let's simplify the code and remove the variable entirely. There's only
one use of namelen anyway, so we can just call strlen() then. It's true
this is in a loop, so we might execute strlen() more often. But:

  - this is test code that only ever loops twice in our test suite (we
    do loop 1000 times in a t/perf test, but without using this option).

  - a decent compiler ought to be able to hoist that out of the loop
    anyway (though I wouldn't count on gcc 9.2.1 doing so!)

Reported-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-09-06 11:03:39 -07:00
..
.gitignore
test-chmtime.c
test-config.c
test-ctype.c
test-date.c test-date: drop unused "now" parameter from parse_dates() 2019-03-20 18:34:09 +09:00
test-delta.c
test-dir-iterator.c Merge branch 'mt/dir-iterator-updates' 2019-08-09 10:13:14 -07:00
test-drop-caches.c
test-dump-cache-tree.c
test-dump-fsmonitor.c cache.h: flip NO_THE_INDEX_COMPATIBILITY_MACROS switch 2019-01-24 11:55:06 -08:00
test-dump-split-index.c
test-dump-untracked-cache.c cache.h: flip NO_THE_INDEX_COMPATIBILITY_MACROS switch 2019-01-24 11:55:06 -08:00
test-example-decorate.c object: convert lookup_unknown_object() to use object_id 2019-06-20 10:06:19 -07:00
test-fake-ssh.c
test-genrandom.c
test-genzeros.c tests: teach the test-tool to generate NUL bytes and use it 2019-02-19 10:22:21 -08:00
test-hash-speed.c t/helper: add a test helper to compute hash speed 2018-11-14 16:54:52 +09:00
test-hash.c
test-hashmap.c test-hashmap: remove 'hash' command 2019-06-17 18:11:42 -07:00
test-index-version.c
test-json-writer.c
test-lazy-init-name-hash.c
test-line-buffer.c
test-match-trees.c match-trees.c: remove the_repo from shift_tree*() 2019-06-27 12:45:17 -07:00
test-mergesort.c
test-mktemp.c
test-oidmap.c test-oidmap: remove 'add' subcommand 2019-07-01 10:26:28 -07:00
test-online-cpus.c
test-parse-options.c parse-options: don't emit "ambiguous option" for aliases 2019-05-07 12:23:22 +09:00
test-path-utils.c ci: parallelize testing on Windows 2019-01-29 09:26:47 -08:00
test-pkt-line.c
test-prio-queue.c test-prio-queue: use xmalloc 2019-04-12 13:34:17 +09:00
test-reach.c
test-read-cache.c test-read-cache: drop namelen variable 2019-09-06 11:03:39 -07:00
test-read-midx.c
test-ref-store.c Merge branch 'cc/test-ref-store-typofix' 2019-02-05 14:26:13 -08:00
test-regex.c
test-repository.c t/helper/test-repository: celebrate independence from the_repository 2018-12-28 10:06:33 -08:00
test-revision-walking.c
test-run-command.c
test-scrap-cache-tree.c
test-serve-v2.c Turn git serve into a test helper 2019-04-19 14:03:24 +09:00
test-sha1-array.c
test-sha1.c
test-sha1.sh
test-sha256.c Add a base implementation of SHA-256 support 2018-11-14 16:54:53 +09:00
test-sigchain.c style: the opening '{' of a function is in a separate line 2018-12-10 15:41:09 +09:00
test-strcmp-offset.c
test-string-list.c
test-submodule-config.c
test-submodule-nested-repo-config.c repository: repo_submodule_init to take a submodule struct 2018-12-05 11:42:32 +09:00
test-subprocess.c
test-svn-fe.c
test-tool.c Merge branch 'mt/dir-iterator-updates' 2019-07-25 13:59:22 -07:00
test-tool.h Merge branch 'mt/dir-iterator-updates' 2019-07-25 13:59:22 -07:00
test-trace2.c trace2: t/helper/test-trace2, t0210.sh, t0211.sh, t0212.sh 2019-02-22 15:28:22 -08:00
test-urlmatch-normalization.c
test-wildmatch.c
test-windows-named-pipe.c
test-write-cache.c
test-xml-encode.c tests: optionally write results as JUnit-style .xml 2019-01-29 09:26:46 -08:00