Commit 1af64f7
sha1_file: introduce a constant for max header length
There were several instances of 32 sprinkled throughout this file, all
of which were used for allocating a buffer to store the header of an
object. Introduce a constant, MAX_HEADER_LEN, for this purpose.
Note that this constant is slightly larger than required; the longest
possible header is 28 (7 for "commit", 1 for a space, 20 for a 63-bit
length in decimal, and 1 for the NUL). However, the overallocation
should not cause any problems, so leave it as it is.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent b383a13 commit 1af64f7
1 file changed
+10
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
33 | 36 | | |
34 | 37 | | |
35 | 38 | | |
| |||
791 | 794 | | |
792 | 795 | | |
793 | 796 | | |
794 | | - | |
| 797 | + | |
795 | 798 | | |
796 | 799 | | |
797 | 800 | | |
| |||
1150 | 1153 | | |
1151 | 1154 | | |
1152 | 1155 | | |
1153 | | - | |
| 1156 | + | |
1154 | 1157 | | |
1155 | 1158 | | |
1156 | 1159 | | |
| |||
1514 | 1517 | | |
1515 | 1518 | | |
1516 | 1519 | | |
1517 | | - | |
| 1520 | + | |
1518 | 1521 | | |
1519 | 1522 | | |
1520 | 1523 | | |
| |||
1669 | 1672 | | |
1670 | 1673 | | |
1671 | 1674 | | |
1672 | | - | |
| 1675 | + | |
1673 | 1676 | | |
1674 | 1677 | | |
1675 | 1678 | | |
| |||
1689 | 1692 | | |
1690 | 1693 | | |
1691 | 1694 | | |
1692 | | - | |
| 1695 | + | |
1693 | 1696 | | |
1694 | 1697 | | |
1695 | 1698 | | |
| |||
1709 | 1712 | | |
1710 | 1713 | | |
1711 | 1714 | | |
1712 | | - | |
| 1715 | + | |
1713 | 1716 | | |
1714 | 1717 | | |
1715 | 1718 | | |
| |||
2191 | 2194 | | |
2192 | 2195 | | |
2193 | 2196 | | |
2194 | | - | |
| 2197 | + | |
2195 | 2198 | | |
2196 | 2199 | | |
2197 | 2200 | | |
| |||
0 commit comments