Mercurial > vim
diff src/evalfunc.c @ 24770:e75971b83263 v8.2.2923
patch 8.2.2923: EBCDIC build is broken
Commit: https://github.com/vim/vim/commit/eecf2b35a146d7d5512f2525ad631d796e19edac
Author: K.Takata <kentkt@csc.jp>
Date: Wed Jun 2 14:56:39 2021 +0200
patch 8.2.2923: EBCDIC build is broken
Problem: EBCDIC build is broken.
Solution: Move sortFunctions() to evalfunc.c. (Ken Takata, closes https://github.com/vim/vim/issues/8306)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 02 Jun 2021 15:00:03 +0200 |
parents | 7334bf933510 |
children | 7bc92a651472 |
line wrap: on
line diff
--- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -1855,6 +1855,33 @@ static funcentry_T global_functions[] = ret_number, f_xor}, }; +#if defined(EBCDIC) || defined(PROTO) +/* + * Compare funcentry_T by function name. + */ + static int +compare_func_name(const void *s1, const void *s2) +{ + funcentry_T *p1 = (funcentry_T *)s1; + funcentry_T *p2 = (funcentry_T *)s2; + + return STRCMP(p1->f_name, p2->f_name); +} + +/* + * Sort the function table by function name. + * The sorting of the table above is ASCII dependent. + * On machines using EBCDIC we have to sort it. + */ + void +sortFunctions(void) +{ + size_t funcCnt = ARRAY_LENGTH(global_functions); + + qsort(global_functions, funcCnt, sizeof(funcentry_T), compare_func_name); +} +#endif + /* * Function given to ExpandGeneric() to obtain the list of internal * or user defined function names.