summaryrefslogtreecommitdiff
path: root/contrib/coccinelle/swap.cocci
AgeCommit message (Collapse)AuthorFilesLines
2017-01-30add SWAP macroLibravatar René Scharfe1-0/+28
Add a macro for exchanging the values of variables. It allows users to avoid repetition and takes care of the temporary variable for them. It also makes sure that the storage sizes of its two parameters are the same. Its memcpy(1) calls are optimized away by current compilers. Also add a conservative semantic patch for transforming only swaps of variables of the same type. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>