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-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
test-dump-split-index.c
test-dump-untracked-cache.c
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
test-hash-speed.c
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
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
test-regex.c
test-repository.c
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
test-sigchain.c
test-strcmp-offset.c
test-string-list.c
test-submodule-config.c
test-submodule-nested-repo-config.c
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
test-urlmatch-normalization.c
test-wildmatch.c
test-windows-named-pipe.c
test-write-cache.c
test-xml-encode.c