@@ -117,10 +117,8 @@ const char *write_idx_file(const char *index_name, struct pack_idx_entry **objec
117
117
list = sorted_by_sha ;
118
118
for (i = 0 ; i < nr_objects ; i ++ ) {
119
119
struct pack_idx_entry * obj = * list ++ ;
120
- if (index_version < 2 ) {
121
- uint32_t offset = htonl (obj -> offset );
122
- hashwrite (f , & offset , 4 );
123
- }
120
+ if (index_version < 2 )
121
+ hashwrite_be32 (f , obj -> offset );
124
122
hashwrite (f , obj -> oid .hash , the_hash_algo -> rawsz );
125
123
if ((opts -> flags & WRITE_IDX_STRICT ) &&
126
124
(i && oideq (& list [-2 ]-> oid , & obj -> oid )))
@@ -135,8 +133,7 @@ const char *write_idx_file(const char *index_name, struct pack_idx_entry **objec
135
133
list = sorted_by_sha ;
136
134
for (i = 0 ; i < nr_objects ; i ++ ) {
137
135
struct pack_idx_entry * obj = * list ++ ;
138
- uint32_t crc32_val = htonl (obj -> crc32 );
139
- hashwrite (f , & crc32_val , 4 );
136
+ hashwrite_be32 (f , obj -> crc32 );
140
137
}
141
138
142
139
/* write the 32-bit offset table */
@@ -148,8 +145,7 @@ const char *write_idx_file(const char *index_name, struct pack_idx_entry **objec
148
145
offset = (need_large_offset (obj -> offset , opts )
149
146
? (0x80000000 | nr_large_offset ++ )
150
147
: obj -> offset );
151
- offset = htonl (offset );
152
- hashwrite (f , & offset , 4 );
148
+ hashwrite_be32 (f , offset );
153
149
}
154
150
155
151
/* write the large offset table */
0 commit comments