From eae677b089f16afe1b68269853f9a8453996b2f1 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Fri, 29 May 2009 15:10:24 -0700 Subject: [PATCH] Run Nindent on com32/lib/qsort.c Automatically reformat com32/lib/qsort.c using Nindent. Do this for all files except HDT, gPXE and externally maintained libraries (zlib, tinyjpeg, libpng). Signed-off-by: H. Peter Anvin --- com32/lib/qsort.c | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/com32/lib/qsort.c b/com32/lib/qsort.c index 312872d..a67866d 100644 --- a/com32/lib/qsort.c +++ b/com32/lib/qsort.c @@ -10,32 +10,33 @@ static inline size_t newgap(size_t gap) { - gap = (gap*10)/13; - if ( gap == 9 || gap == 10 ) - gap = 11; + gap = (gap * 10) / 13; + if (gap == 9 || gap == 10) + gap = 11; - if ( gap < 1 ) - gap = 1; - return gap; + if (gap < 1) + gap = 1; + return gap; } -void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) +void qsort(void *base, size_t nmemb, size_t size, + int (*compar) (const void *, const void *)) { - size_t gap = nmemb; - size_t i, j; - char *p1, *p2; - int swapped; + size_t gap = nmemb; + size_t i, j; + char *p1, *p2; + int swapped; - do { - gap = newgap(gap); - swapped = 0; + do { + gap = newgap(gap); + swapped = 0; - for ( i = 0, p1 = base ; i < nmemb-gap ; i++, p1 += size ) { - j = i+gap; - if ( compar(p1, p2 = (char *)base+j*size) > 0 ) { - memswap(p1, p2, size); - swapped = 1; - } - } - } while ( gap > 1 || swapped ); + for (i = 0, p1 = base; i < nmemb - gap; i++, p1 += size) { + j = i + gap; + if (compar(p1, p2 = (char *)base + j * size) > 0) { + memswap(p1, p2, size); + swapped = 1; + } + } + } while (gap > 1 || swapped); } -- 2.7.4