summaryrefslogtreecommitdiff
path: root/protocol.h
diff options
context:
space:
mode:
authorLibravatar René Scharfe <l.s.r@web.de>2019-06-15 20:32:58 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-06-17 18:14:59 -0700
commit177fbab747da4f58cb2a8ce010b3515c86dd67c9 (patch)
treef3936a6b4db9c110bef4bb4a28131ec6de06aa25 /protocol.h
parentGit 2.22 (diff)
downloadtgif-177fbab747da4f58cb2a8ce010b3515c86dd67c9.tar.xz
coccinelle: use COPY_ARRAY for copying arrays
The current semantic patch for COPY_ARRAY transforms memcpy(3) calls on pointers, but Coccinelle distinguishes them from arrays. It already contains three rules to handle the options for sizeof (i.e. source, destination and type), and handling arrays as source and destination would require four times as many rules if we enumerated all cases. We also don't handle array subscripts, and supporting that would increase the number of rules by another factor of four. (An isomorphism telling Coccinelle that "sizeof x[...]" is equivalent to "sizeof *x" would be nice..) Support arrays and array subscripts, but keep the number of rules down by adding normalization steps: First turn array subscripts into derefences, then determine the types of expressions used with sizeof and replace them with these types, and then convert the different possible combinations of arrays and pointers with memcpy(3) to COPY_ARRAY. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'protocol.h')
0 files changed, 0 insertions, 0 deletions