diff options
author | Jeff King <peff@peff.net> | 2019-09-05 18:53:37 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-09-06 11:03:39 -0700 |
commit | e4b369069e4a7630233a045784d0b1e2425b0a05 (patch) | |
tree | b8d944e9736c98e4dd6ca7a0c3e0a00bdafa0d6d /t/helper | |
parent | bulk-checkin: zero-initialize hashfile_checkpoint (diff) | |
download | tgif-e4b369069e4a7630233a045784d0b1e2425b0a05.tar.xz |
diff-delta: set size out-parameter to 0 for NULL delta
When we cannot generate a delta, we return NULL but leave delta_size
untouched. This is generally OK, as callers rely on NULL to decide if
the output is usable or not. But it can confuse compilers; in
particular, gcc 9.2.1 with "-flto -O3" complains in fast-import's
store_object() that delta_len may be used uninitialized.
Let's change the diff-delta code to set the size explicitly to 0 for a
NULL return. That silences the compiler and makes it easier to reason
about the result.
Reported-by: Stephan Beyer <s-beyer@gmx.net>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/helper')
0 files changed, 0 insertions, 0 deletions