mirror of
https://github.com/neovim/neovim.git
synced 2025-09-13 06:48:17 +00:00
Remove feature HAVE_QSORT
qsort conforms to C99, so we don't need our own version.
This commit is contained in:

committed by
Thiago de Arruda

parent
7b14caf604
commit
f9b5ca8b85
@@ -56,7 +56,6 @@
|
|||||||
#define HAVE_POLL_H 1
|
#define HAVE_POLL_H 1
|
||||||
#define HAVE_PUTENV 1
|
#define HAVE_PUTENV 1
|
||||||
#define HAVE_PWD_H 1
|
#define HAVE_PWD_H 1
|
||||||
#define HAVE_QSORT 1
|
|
||||||
#define HAVE_READLINK 1
|
#define HAVE_READLINK 1
|
||||||
#define HAVE_RENAME 1
|
#define HAVE_RENAME 1
|
||||||
#define HAVE_SELECT 1
|
#define HAVE_SELECT 1
|
||||||
|
@@ -12,6 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "vim.h"
|
#include "vim.h"
|
||||||
#include "eval.h"
|
#include "eval.h"
|
||||||
|
@@ -12,6 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "vim.h"
|
#include "vim.h"
|
||||||
#include "version_defs.h"
|
#include "version_defs.h"
|
||||||
|
@@ -12,6 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "vim.h"
|
#include "vim.h"
|
||||||
#include "arabic.h"
|
#include "arabic.h"
|
||||||
|
39
src/misc2.c
39
src/misc2.c
@@ -1701,45 +1701,6 @@ int vim_chdir(char_u *new_dir)
|
|||||||
return r;
|
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.
|
* Sort an array of strings.
|
||||||
*/
|
*/
|
||||||
|
@@ -13,6 +13,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "vim.h"
|
#include "vim.h"
|
||||||
#include "normal.h"
|
#include "normal.h"
|
||||||
|
@@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#define IN_OPTION_C
|
#define IN_OPTION_C
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "vim.h"
|
#include "vim.h"
|
||||||
#include "option.h"
|
#include "option.h"
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "vim.h"
|
#include "vim.h"
|
||||||
#include "path.h"
|
#include "path.h"
|
||||||
#include "charset.h"
|
#include "charset.h"
|
||||||
|
@@ -49,11 +49,6 @@ int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs)
|
|||||||
#ifndef HAVE_STRPBRK /* not generated automatically from misc2.c */
|
#ifndef HAVE_STRPBRK /* not generated automatically from misc2.c */
|
||||||
char_u *vim_strpbrk(char_u *s, char_u *charset);
|
char_u *vim_strpbrk(char_u *s, char_u *charset);
|
||||||
#endif
|
#endif
|
||||||
#ifndef HAVE_QSORT
|
|
||||||
/* Use our own qsort(), don't define the prototype when not used. */
|
|
||||||
void qsort(void *base, size_t elm_count, size_t elm_size,
|
|
||||||
int (*cmp)(const void *, const void *));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Ugly solution for "BalloonEval" not being defined while it's used in some
|
/* Ugly solution for "BalloonEval" not being defined while it's used in some
|
||||||
* .pro files. */
|
* .pro files. */
|
||||||
|
@@ -298,6 +298,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "vim.h"
|
#include "vim.h"
|
||||||
#include "spell.h"
|
#include "spell.h"
|
||||||
|
@@ -12,6 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "vim.h"
|
#include "vim.h"
|
||||||
#include "syntax.h"
|
#include "syntax.h"
|
||||||
|
Reference in New Issue
Block a user