summaryrefslogtreecommitdiff
path: root/src/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/src/eval.c b/src/eval.c
index 11fc035fb..5bed90b3b 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -242,14 +242,38 @@ static void list_one_var(dictitem_T *v, char_u *prefix, int *first);
static void list_one_var_a(char_u *prefix, char_u *name, int type, char_u *string, int *first);
static char_u *find_option_end(char_u **arg, int *opt_flags);
-#ifdef EBCDIC
-static int compare_func_name(const void *s1, const void *s2);
-static void sortFunctions();
-#endif
-
/* for VIM_VERSION_ defines */
#include "version.h"
+
+#if defined(EBCDIC) || defined(PROTO)
+/*
+ * Compare struct fst by function name.
+ */
+ static int
+compare_func_name(const void *s1, const void *s2)
+{
+ struct fst *p1 = (struct fst *)s1;
+ struct fst *p2 = (struct fst *)s2;
+
+ return STRCMP(p1->f_name, p2->f_name);
+}
+
+/*
+ * Sort the function table by function name.
+ * The sorting of the table above is ASCII dependant.
+ * On machines using EBCDIC we have to sort it.
+ */
+ static void
+sortFunctions(void)
+{
+ int funcCnt = (int)(sizeof(functions) / sizeof(struct fst)) - 1;
+
+ qsort(functions, (size_t)funcCnt, sizeof(struct fst), compare_func_name);
+}
+#endif
+
+
/*
* Initialize the global and v: variables.
*/