Skip to content

Commit 176380f

Browse files
peffgitster
authored andcommitted
Revert "fast-export: use local array to store anonymized oid"
This reverts commit f39ad38. 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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c578e29 commit 176380f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

builtin/fast-export.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -405,12 +405,12 @@ static char *generate_fake_oid(void *data)
405405
{
406406
static uint32_t counter = 1; /* avoid null oid */
407407
const unsigned hashsz = the_hash_algo->rawsz;
408-
unsigned char out[GIT_MAX_RAWSZ];
408+
struct object_id oid;
409409
char *hex = xmallocz(GIT_MAX_HEXSZ);
410410

411-
hashclr(out);
412-
put_be32(out + hashsz - 4, counter++);
413-
return hash_to_hex_algop_r(hex, out, the_hash_algo);
411+
oidclr(&oid);
412+
put_be32(oid.hash + hashsz - 4, counter++);
413+
return oid_to_hex_r(hex, &oid);
414414
}
415415

416416
static const char *anonymize_oid(const char *oid_hex)

0 commit comments

Comments
 (0)