From f9b5ca8b857b425635557dda9e587a7c43d1739a Mon Sep 17 00:00:00 2001 From: oni-link Date: Mon, 31 Mar 2014 22:20:59 +0200 Subject: Remove feature HAVE_QSORT qsort conforms to C99, so we don't need our own version. --- src/misc2.c | 39 --------------------------------------- 1 file changed, 39 deletions(-) (limited to 'src/misc2.c') diff --git a/src/misc2.c b/src/misc2.c index 703ec6d304..30ebb88b66 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -1701,45 +1701,6 @@ int vim_chdir(char_u *new_dir) return r; } -#ifndef HAVE_QSORT -/* - * Our own qsort(), for systems that don't have it. - * It's simple and slow. From the K&R C book. - */ -void qsort(base, elm_count, elm_size, cmp) -void *base; -size_t elm_count; -size_t elm_size; -int (*cmp)(const void *, const void *); -{ - char_u *buf; - char_u *p1; - char_u *p2; - int i, j; - int gap; - - buf = alloc((unsigned)elm_size); - if (buf == NULL) - return; - - for (gap = elm_count / 2; gap > 0; gap /= 2) - for (i = gap; i < elm_count; ++i) - for (j = i - gap; j >= 0; j -= gap) { - /* Compare the elements. */ - p1 = (char_u *)base + j * elm_size; - p2 = (char_u *)base + (j + gap) * elm_size; - if ((*cmp)((void *)p1, (void *)p2) <= 0) - break; - /* Exchange the elements. */ - memmove(buf, p1, elm_size); - memmove(p1, p2, elm_size); - memmove(p2, buf, elm_size); - } - - vim_free(buf); -} -#endif - /* * Sort an array of strings. */ -- cgit