t/helper/test-lazy-name-hash: fix compilation
commit74dea0e13cb5192f5754ccbb40054472d62f4aaf
authorStefan Beller <sbeller@google.com>
Mon, 18 Dec 2017 21:49:47 +0000 (18 13:49 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 22 Dec 2017 18:42:04 +0000 (22 10:42 -0800)
tree6de2f1b714ecb27e586d85378045dc39ef9a4708
parent41b3eb4a6bff4d38bb188d28544bf901080d9e96
t/helper/test-lazy-name-hash: fix compilation

I was compiling origin/master today with DEVELOPER compiler flags
and was greeted by:

t/helper/test-lazy-init-name-hash.c: In function ‘cmd_main’:
t/helper/test-lazy-init-name-hash.c:172:5: error: ‘nr_threads_used’ may be used uninitilized in this function [-Werror=maybe-uninitialized]
     printf("avg [size %8d] [single %f] %c [multi %f %d]\n",
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         nr,
         ~~~
         (double)avg_single/1000000000,
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         (avg_single < avg_multi ? '<' : '>'),
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         (double)avg_multi/1000000000,
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         nr_threads_used);
         ~~~~~~~~~~~~~~~~
t/helper/test-lazy-init-name-hash.c:115:6: note: ‘nr_threads_used’ was declared here
  int nr_threads_used;
      ^~~~~~~~~~~~~~~

I do not see how we can arrive at that line without having `nr_threads_used`
initialized, as we'd have `count > 1`  (which asserts that we ran the
loop above at least once, such that it *should* be initialized).

Just clear the variable at the beginning of the function to squelch
the warning.

Signed-off-by: Stefan Beller <sbeller@google.com>
Acked-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/helper/test-lazy-init-name-hash.c