hash.h: move SHA-1 implementation selection into a header file
authorbrian m. carlson <sandals@crustytoothpaste.net>
Sat, 11 Mar 2017 22:28:18 +0000 (22:28 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 14 Mar 2017 21:44:38 +0000 (14:44 -0700)
commit22369609570e6329e079b5d7f37a7c32063f336c
treeab20ace5a3723ed57b37bb93ca2c36267ca3592f
parente7e07d5a4fcc2a203d9873968ad3e6bd4d7419d7
hash.h: move SHA-1 implementation selection into a header file

Many developers use functionality in their editors that allows for quick
syntax checks, including warning about questionable constructs.  This
functionality allows rapid development with fewer errors.  However, such
functionality generally does not allow the specification of
project-specific defines or command-line options.

Since the SHA1_HEADER include is not defined in such a case, developers
see spurious errors when using these tools.  Furthermore, while using a
macro as the argument to #include is permitted by C11, it isn't
permitted by C89 and C99, and there are known implementations which
reject it.

Instead of using SHA1_HEADER, create a hash.h header and use #if
and #elif to select the desired header.  Have the Makefile pass an
appropriate option to help the header select the right implementation to
use.

[jc: make BLK_SHA1 the fallback default as discussed on list,
e.g. <20170314201424.vccij5z2ortq4a4o@sigill.intra.peff.net>; also
remove SHA1_HEADER and SHA1_HEADER_SQ that are no longer used].

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile
cache.h
hash.h [new file with mode: 0644]