diff options
author | Jeff King <peff@peff.net> | 2020-09-24 15:22:29 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-09-24 12:30:11 -0700 |
commit | 176380fd113a97b09c99a5f7273725527823fa1b (patch) | |
tree | 0a004dc5a516372b75a3fca87b160b974a82990a /builtin | |
parent | bswap.h: drop unaligned loads (diff) | |
download | tgif-176380fd113a97b09c99a5f7273725527823fa1b.tar.xz |
Revert "fast-export: use local array to store anonymized oid"
This reverts commit f39ad38410da554af54966bf74fa0402355852ac.
That commit was trying to silence a type-punning warning on older
versions of gcc. However, its analysis was all wrong. I didn't notice
that we _were_ in fact type-punning because there are two versions of
put_be32(): one that uses casts and unaligned loads, and another that
uses bitshifts. I looked at the latter, but on my platform we were
defaulting to the former.
However, as of the previous commit, we'll always use the bitshift
version. So we can drop this hackery to avoid the warning, making the
code slightly cleaner.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/fast-export.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/builtin/fast-export.c b/builtin/fast-export.c index 9f37895d4c..c6ecf404d7 100644 --- a/builtin/fast-export.c +++ b/builtin/fast-export.c @@ -405,12 +405,12 @@ static char *generate_fake_oid(void *data) { static uint32_t counter = 1; /* avoid null oid */ const unsigned hashsz = the_hash_algo->rawsz; - unsigned char out[GIT_MAX_RAWSZ]; + struct object_id oid; char *hex = xmallocz(GIT_MAX_HEXSZ); - hashclr(out); - put_be32(out + hashsz - 4, counter++); - return hash_to_hex_algop_r(hex, out, the_hash_algo); + oidclr(&oid); + put_be32(oid.hash + hashsz - 4, counter++); + return oid_to_hex_r(hex, &oid); } static const char *anonymize_oid(const char *oid_hex) |