]> git.ipfire.org Git - thirdparty/git.git/commit
git_mkstemps_mode(): replace magic numbers with computed value
authorJeff King <peff@peff.net>
Wed, 2 Oct 2019 15:32:07 +0000 (11:32 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 3 Oct 2019 00:58:25 +0000 (09:58 +0900)
commit53d687bf5f8008abd52b92120c7e22d4d81bdc71
treea4d9ff6c1e026ce15b5e1aab9c13b1911624bdd4
parent54a80a9ad84af001470ea22fb0a14f6dc844b9c9
git_mkstemps_mode(): replace magic numbers with computed value

The magic number "6" appears several times in the function, and is
related to the size of the "XXXXXX" string we expect to find in the
template. Let's pull that "XXXXXX" into a constant array, whose size we
can get at compile time with ARRAY_SIZE().

Note that we probably can't just change this value, since callers will
be feeding us a certain number of X's, but it hopefully makes the
function itself easier to follow.

While we're here, let's do the same with the "letters" array (which we
_could_ modify if we wanted to include more characters).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
wrapper.c