Commit 01cab97
object-file.c: simplify unpack_loose_short_header()
Combine the unpack_loose_short_header(),
unpack_loose_header_to_strbuf() and unpack_loose_header() functions
into one.
The unpack_loose_header_to_strbuf() function was added in
46f0344 (sha1_file: support reading from a loose object of unknown
type, 2015-05-03).
Its code was mostly copy/pasted between it and both of
unpack_loose_header() and unpack_loose_short_header(). We now have a
single unpack_loose_header() function which accepts an optional
"struct strbuf *" instead.
I think the remaining unpack_loose_header() function could be further
simplified, we're carrying some complexity just to be able to emit a
garbage type longer than MAX_HEADER_LEN, we could alternatively just
say "we found a garbage type <first 32 bytes>..." instead. But let's
leave the current behavior in place for now.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent ddb3474 commit 01cab97
3 files changed
+38
-40
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1302 | 1302 | | |
1303 | 1303 | | |
1304 | 1304 | | |
1305 | | - | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
1306 | 1321 | | |
1307 | 1322 | | |
1308 | 1323 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1210 | 1210 | | |
1211 | 1211 | | |
1212 | 1212 | | |
1213 | | - | |
1214 | | - | |
1215 | | - | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
1216 | 1217 | | |
1217 | | - | |
| 1218 | + | |
1218 | 1219 | | |
1219 | 1220 | | |
1220 | 1221 | | |
| |||
1225 | 1226 | | |
1226 | 1227 | | |
1227 | 1228 | | |
1228 | | - | |
| 1229 | + | |
1229 | 1230 | | |
1230 | | - | |
1231 | | - | |
1232 | | - | |
1233 | | - | |
1234 | | - | |
1235 | | - | |
1236 | | - | |
1237 | | - | |
1238 | | - | |
1239 | | - | |
1240 | | - | |
1241 | | - | |
1242 | | - | |
1243 | | - | |
1244 | | - | |
1245 | | - | |
1246 | | - | |
1247 | | - | |
1248 | | - | |
1249 | | - | |
1250 | | - | |
1251 | | - | |
1252 | | - | |
1253 | | - | |
1254 | | - | |
1255 | | - | |
1256 | | - | |
1257 | 1231 | | |
1258 | 1232 | | |
1259 | 1233 | | |
| |||
1263 | 1237 | | |
1264 | 1238 | | |
1265 | 1239 | | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
1266 | 1248 | | |
1267 | 1249 | | |
1268 | 1250 | | |
| |||
1412 | 1394 | | |
1413 | 1395 | | |
1414 | 1396 | | |
| 1397 | + | |
1415 | 1398 | | |
1416 | 1399 | | |
1417 | 1400 | | |
| |||
1445 | 1428 | | |
1446 | 1429 | | |
1447 | 1430 | | |
1448 | | - | |
1449 | | - | |
1450 | | - | |
1451 | | - | |
1452 | | - | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
1453 | 1434 | | |
1454 | 1435 | | |
1455 | 1436 | | |
| |||
2550 | 2531 | | |
2551 | 2532 | | |
2552 | 2533 | | |
2553 | | - | |
| 2534 | + | |
| 2535 | + | |
2554 | 2536 | | |
2555 | 2537 | | |
2556 | 2538 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
236 | | - | |
| 236 | + | |
| 237 | + | |
237 | 238 | | |
238 | 239 | | |
239 | 240 | | |
| |||
0 commit comments