diff options
author | 2020-11-29 20:52:21 +0100 | |
---|---|---|
committer | 2020-11-30 13:55:54 -0800 | |
commit | 6ba9bb76e0279bce9f614cb7f4ee28d8a601e79e (patch) | |
tree | c7c287563a004035efd7ddfa6298a60d2b3cc5ea /t/t5312-prune-corruption.sh | |
parent | grep: use designated initializers for `grep_defaults` (diff) | |
download | tgif-6ba9bb76e0279bce9f614cb7f4ee28d8a601e79e.tar.xz |
grep: copy struct in one fell swoop
We have a `struct grep_opt` with our defaults which we then copy into
the caller's struct. Rather than zeroing the target struct and copying
each element one by one, just copy everything at once. This leaves the
code simpler and more maintainable.
We don't have any ownership issues with what we're copying now and can
just greedily copy the whole thing. If and when we do need to handle
such elements (`char *`?), we must and can handle it appropriately. Make
sure to leave a comment to our future selves.
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5312-prune-corruption.sh')
0 files changed, 0 insertions, 0 deletions