From 2f97939efdd1633d0507cf321ca93ada1310e42c Mon Sep 17 00:00:00 2001 From: Leo Yuriev Date: Tue, 23 May 2017 15:42:14 +0300 Subject: [PATCH] mdbx: more cleanup mdbx_midl_sort(). --- src/mdbx.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/mdbx.c b/src/mdbx.c index bf67a0e8..6c6941fa 100644 --- a/src/mdbx.c +++ b/src/mdbx.c @@ -9411,11 +9411,11 @@ static void __hot mdbx_midl_xmerge(MDB_IDL idl, MDB_IDL merge) { /* Quicksort + Insertion sort for small arrays */ #define SMALL 8 #define MIDL_SWAP(a, b) \ - { \ - pgno_t itmp = (a); \ + do { \ + pgno_t tmp_pgno = (a); \ (a) = (b); \ - (b) = itmp; \ - } + (b) = tmp_pgno; \ + } while (0) static void __hot mdbx_midl_sort(MDB_IDL ids) { /* Max possible depth of int-indexed tree * 2 items/level */ @@ -9444,15 +9444,15 @@ static void __hot mdbx_midl_sort(MDB_IDL ids) { } else { k = (l + ir) >> 1; /* Choose median of left, center, right */ MIDL_SWAP(ids[k], ids[l + 1]); - if (ids[l] < ids[ir]) { + if (ids[l] < ids[ir]) MIDL_SWAP(ids[l], ids[ir]); - } - if (ids[l + 1] < ids[ir]) { + + if (ids[l + 1] < ids[ir]) MIDL_SWAP(ids[l + 1], ids[ir]); - } - if (ids[l] < ids[l + 1]) { + + if (ids[l] < ids[l + 1]) MIDL_SWAP(ids[l], ids[l + 1]); - } + i = l + 1; j = ir; a = ids[l + 1];