Commit adab1f6
committed
odb: do not use "blank" substitute for NULL
When various *object_info() functions are given an extended object
info structure as NULL by a caller that does not want any details,
the code uses a file-scope static blank_oi to pass it down to the
helper functions they use, to avoid handling NULL specifically.
The ps/object-read-stream topic graduated to 'master' recently
however had a bug that assumed that two identically named file-scope
static variables in two functions are the same, which of course is
not the case. This made "git commit" take 0.38 seconds to 1508
seconds in some case, as reported by Aaron Plattner here:
https://lore.kernel.org/git/[email protected]/
We _could_ move the blank_oi variable to a global scope in BSS to
fix this regression, but explicitly handling the NULL is a much
safer fix. It would also reduce the chance of errors that somebody
accidentally writes into blank_oi, making its contents dirty, which
potentially will make subsequent calls into the callpath misbehave.
By explicitly handling NULL input, we no longer have to worry about
it.
Reported-by: Aaron Plattner <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>1 parent 1da2a42 commit adab1f6
3 files changed
+18
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
426 | 426 | | |
427 | 427 | | |
428 | 428 | | |
429 | | - | |
| 429 | + | |
430 | 430 | | |
431 | 431 | | |
432 | 432 | | |
| |||
437 | 437 | | |
438 | 438 | | |
439 | 439 | | |
440 | | - | |
| 440 | + | |
441 | 441 | | |
442 | | - | |
| 442 | + | |
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
446 | | - | |
| 446 | + | |
447 | 447 | | |
448 | 448 | | |
449 | 449 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
664 | 664 | | |
665 | 665 | | |
666 | 666 | | |
667 | | - | |
668 | 667 | | |
669 | 668 | | |
670 | 669 | | |
671 | 670 | | |
672 | | - | |
673 | 671 | | |
674 | 672 | | |
675 | 673 | | |
676 | 674 | | |
677 | 675 | | |
678 | 676 | | |
679 | | - | |
680 | | - | |
681 | | - | |
682 | 677 | | |
683 | 678 | | |
684 | | - | |
685 | | - | |
686 | | - | |
687 | | - | |
688 | | - | |
689 | | - | |
690 | | - | |
691 | | - | |
692 | | - | |
693 | | - | |
694 | | - | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
695 | 692 | | |
696 | 693 | | |
697 | 694 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2095 | 2095 | | |
2096 | 2096 | | |
2097 | 2097 | | |
2098 | | - | |
2099 | 2098 | | |
2100 | 2099 | | |
2101 | 2100 | | |
| |||
2106 | 2105 | | |
2107 | 2106 | | |
2108 | 2107 | | |
2109 | | - | |
| 2108 | + | |
2110 | 2109 | | |
2111 | 2110 | | |
2112 | 2111 | | |
| |||
0 commit comments