[PATCH v3 2/6] sha1_file.c: keep a good name for "unknown" hash_algos[UNKNOWN]
- From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Date
- Feb 25, 2018, 11:18 UTC
- Message-ID
- <20180225111840.16421-3-pclouds@gmail.com>
- In-Reply-To
- <20180225111840.16421-1-pclouds@gmail.com>
This is mostly for displaying the hash algorithm name when we report errors. Printing "unknown" with '%s' is much better than '(null)' in glibc printf version (and probably could crash if other implementations do not check for NULL pointer)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> --- sha1_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sha1_file.c b/sha1_file.c index 826d7a0ae3..4b266b1c68 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -71,7 +71,7 @@ static void git_hash_unknown_final(unsigned char *hash, git_hash_ctx *ctx) const struct git_hash_algo hash_algos[GIT_HASH_NALGOS] = { { - NULL, + "unknown", 0x00000000, 0, 0,
-- 2.16.1.435.g8f24da2e1a