mirror of
https://github.com/neovim/neovim.git
synced 2025-09-14 15:28:17 +00:00
eval, ex_getln: Fix incompatible pointer types (#8792)
Fixes #8786 gcc (GCC) 8.1.1 20180531 warning: [76/182] Building C object src/nvim/CMakeFiles/nvim.dir/ex_getln.c.o ../src/nvim/ex_getln.c: In function ‘ExpandUserDefined’: ../src/nvim/ex_getln.c:5071:34: warning: cast between incompatible function types from ‘char * (*)(const char * const, const int, const char_u * const* const, const _Bool)’ {aka ‘char * (*)(const char * const, const int, const unsigned char * const* const, const _Bool)’} to ‘void * (*)(char_u *, int, char_u **, int)’ {aka ‘void * (*)(unsigned char *, int, unsigned char **, int)’} [-Wcast-function-type] retstr = call_user_expand_func((user_expand_func_T)call_func_retstr, xp,
This commit is contained in:

committed by
Justin M. Keyes

parent
5d8a47b6e0
commit
b42c80e561
@@ -1186,7 +1186,7 @@ int call_vim_function(
|
|||||||
const char_u *func,
|
const char_u *func,
|
||||||
int argc,
|
int argc,
|
||||||
const char_u *const *const argv,
|
const char_u *const *const argv,
|
||||||
int safe, // use the sandbox
|
bool safe, // use the sandbox
|
||||||
int str_arg_only, // all arguments are strings
|
int str_arg_only, // all arguments are strings
|
||||||
typval_T *rettv
|
typval_T *rettv
|
||||||
)
|
)
|
||||||
@@ -1276,9 +1276,9 @@ varnumber_T call_func_retnr(char_u *func, int argc,
|
|||||||
///
|
///
|
||||||
/// @return [allocated] NULL when calling function fails, allocated string
|
/// @return [allocated] NULL when calling function fails, allocated string
|
||||||
/// otherwise.
|
/// otherwise.
|
||||||
char *call_func_retstr(const char *const func, const int argc,
|
char *call_func_retstr(const char *const func, int argc,
|
||||||
const char_u *const *const argv,
|
const char_u *const *argv,
|
||||||
const bool safe)
|
bool safe)
|
||||||
FUNC_ATTR_NONNULL_ARG(1) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_MALLOC
|
FUNC_ATTR_NONNULL_ARG(1) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_MALLOC
|
||||||
{
|
{
|
||||||
typval_T rettv;
|
typval_T rettv;
|
||||||
@@ -1302,8 +1302,8 @@ char *call_func_retstr(const char *const func, const int argc,
|
|||||||
///
|
///
|
||||||
/// @return [allocated] NULL when calling function fails or return tv is not a
|
/// @return [allocated] NULL when calling function fails or return tv is not a
|
||||||
/// List, allocated List otherwise.
|
/// List, allocated List otherwise.
|
||||||
void *call_func_retlist(char_u *func, int argc, const char_u *const *const argv,
|
void *call_func_retlist(char_u *func, int argc, const char_u *const *argv,
|
||||||
int safe)
|
bool safe)
|
||||||
{
|
{
|
||||||
typval_T rettv;
|
typval_T rettv;
|
||||||
|
|
||||||
|
@@ -201,7 +201,10 @@ static Array cmdline_block = ARRAY_DICT_INIT;
|
|||||||
/*
|
/*
|
||||||
* Type used by call_user_expand_func
|
* Type used by call_user_expand_func
|
||||||
*/
|
*/
|
||||||
typedef void *(*user_expand_func_T)(char_u *, int, char_u **, int);
|
typedef void *(*user_expand_func_T)(const char_u *,
|
||||||
|
int,
|
||||||
|
const char_u * const *,
|
||||||
|
bool);
|
||||||
|
|
||||||
static histentry_T *(history[HIST_COUNT]) = {NULL, NULL, NULL, NULL, NULL};
|
static histentry_T *(history[HIST_COUNT]) = {NULL, NULL, NULL, NULL, NULL};
|
||||||
static int hisidx[HIST_COUNT] = {-1, -1, -1, -1, -1}; /* lastused entry */
|
static int hisidx[HIST_COUNT] = {-1, -1, -1, -1, -1}; /* lastused entry */
|
||||||
@@ -5046,7 +5049,10 @@ static void * call_user_expand_func(user_expand_func_T user_expand_func,
|
|||||||
ccline.cmdprompt = NULL;
|
ccline.cmdprompt = NULL;
|
||||||
current_SID = xp->xp_scriptID;
|
current_SID = xp->xp_scriptID;
|
||||||
|
|
||||||
ret = user_expand_func(xp->xp_arg, 3, args, FALSE);
|
ret = user_expand_func(xp->xp_arg,
|
||||||
|
3,
|
||||||
|
(const char_u * const *)args,
|
||||||
|
false);
|
||||||
|
|
||||||
ccline = save_ccline;
|
ccline = save_ccline;
|
||||||
current_SID = save_current_SID;
|
current_SID = save_current_SID;
|
||||||
@@ -5067,6 +5073,7 @@ static int ExpandUserDefined(expand_T *xp, regmatch_T *regmatch, int *num_file,
|
|||||||
|
|
||||||
char_u *const retstr = call_user_expand_func(
|
char_u *const retstr = call_user_expand_func(
|
||||||
(user_expand_func_T)call_func_retstr, xp, num_file, file);
|
(user_expand_func_T)call_func_retstr, xp, num_file, file);
|
||||||
|
|
||||||
if (retstr == NULL) {
|
if (retstr == NULL) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user