0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.4992: compiler warning for possibly uninitialized variable

Problem:    Compiler warning for possibly uninitialized variable. (Tony
            Mechelynck)
Solution:   Initialize variable in the caller instead of in the function.
This commit is contained in:
Bram Moolenaar
2022-05-21 18:56:58 +01:00
parent 93c1573dd2
commit 5a01caa904
3 changed files with 5 additions and 3 deletions

View File

@@ -4999,6 +4999,7 @@ ex_function(exarg_T *eap)
/* /*
* Find a function by name, including "<lambda>123". * Find a function by name, including "<lambda>123".
* Check for "profile" and "debug" arguments and set"compile_type". * Check for "profile" and "debug" arguments and set"compile_type".
* Caller should initialize "compile_type" to CT_NONE.
* Return NULL if not found. * Return NULL if not found.
*/ */
ufunc_T * ufunc_T *
@@ -5009,7 +5010,6 @@ find_func_by_name(char_u *name, compiletype_T *compile_type)
ufunc_T *ufunc; ufunc_T *ufunc;
int is_global = FALSE; int is_global = FALSE;
*compile_type = CT_NONE;
if (STRNCMP(arg, "profile", 7) == 0 && VIM_ISWHITE(arg[7])) if (STRNCMP(arg, "profile", 7) == 0 && VIM_ISWHITE(arg[7]))
{ {
*compile_type = CT_PROFILE; *compile_type = CT_PROFILE;
@@ -5069,7 +5069,7 @@ ex_defcompile(exarg_T *eap)
if (*eap->arg != NUL) if (*eap->arg != NUL)
{ {
compiletype_T compile_type; compiletype_T compile_type = CT_NONE;
ufunc = find_func_by_name(eap->arg, &compile_type); ufunc = find_func_by_name(eap->arg, &compile_type);
if (ufunc != NULL) if (ufunc != NULL)

View File

@@ -746,6 +746,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
4992,
/**/ /**/
4991, 4991,
/**/ /**/

View File

@@ -6281,7 +6281,7 @@ ex_disassemble(exarg_T *eap)
dfunc_T *dfunc; dfunc_T *dfunc;
isn_T *instr; isn_T *instr;
int instr_count; int instr_count;
compiletype_T compile_type; compiletype_T compile_type = CT_NONE;
ufunc = find_func_by_name(arg, &compile_type); ufunc = find_func_by_name(arg, &compile_type);
if (ufunc == NULL) if (ufunc == NULL)