summaryrefslogtreecommitdiff
path: root/builtin/grep.c
diff options
context:
space:
mode:
authorLibravatar Martin Ågren <martin.agren@gmail.com>2020-11-29 20:52:21 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-11-30 13:55:54 -0800
commit6ba9bb76e0279bce9f614cb7f4ee28d8a601e79e (patch)
treec7c287563a004035efd7ddfa6298a60d2b3cc5ea /builtin/grep.c
parentgrep: use designated initializers for `grep_defaults` (diff)
downloadtgif-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 'builtin/grep.c')
0 files changed, 0 insertions, 0 deletions