summaryrefslogtreecommitdiff
path: root/t/t4133-apply-filenames.sh
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2017-04-24 07:49:20 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-04-24 21:16:44 -0700
commit1f9e18b77282070e8fef6dbe6983a8c94a3b0efa (patch)
treedf955d981f1c7f6b0ef240273fa3e8e1cdf26f2a /t/t4133-apply-filenames.sh
parentt5539: update a flaky test (diff)
downloadtgif-1f9e18b77282070e8fef6dbe6983a8c94a3b0efa.tar.xz
prio_queue_reverse: don't swap elements with themselves
Our array-reverse algorithm does the usual "walk from both ends, swapping elements". We can quit when the two indices are equal, since: 1. Swapping an element with itself is a noop. 2. If i and j are equal, then in the next iteration i is guaranteed to be bigge than j, and we will exit the loop. So exiting the loop on equality is slightly more efficient. And more importantly, the new SWAP() macro does not expect to handle noop swaps; it will call memcpy() with the same src and dst pointers in this case. It's unclear whether that causes a problem on any platforms by violating the "overlapping memory" constraint of memcpy, but it does cause valgrind to complain. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4133-apply-filenames.sh')
0 files changed, 0 insertions, 0 deletions