]> granicus.if.org Git - vim/commitdiff
patch 8.2.4992: compiler warning for possibly uninitialized variable v8.2.4992
authorBram Moolenaar <Bram@vim.org>
Sat, 21 May 2022 17:56:58 +0000 (18:56 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 21 May 2022 17:56:58 +0000 (18:56 +0100)
Problem:    Compiler warning for possibly uninitialized variable. (Tony
            Mechelynck)
Solution:   Initialize variable in the caller instead of in the function.

src/userfunc.c
src/version.c
src/vim9execute.c

index bc4bc45036ce8e7638e7142dda6f6dd86a7c9758..cc477fed331fbf45843269203d792558fb076e28 100644 (file)
@@ -4999,6 +4999,7 @@ ex_function(exarg_T *eap)
 /*
  * Find a function by name, including "<lambda>123".
  * Check for "profile" and "debug" arguments and set"compile_type".
+ * Caller should initialize "compile_type" to CT_NONE.
  * Return NULL if not found.
  */
     ufunc_T *
@@ -5009,7 +5010,6 @@ find_func_by_name(char_u *name, compiletype_T *compile_type)
     ufunc_T    *ufunc;
     int                is_global = FALSE;
 
-    *compile_type = CT_NONE;
     if (STRNCMP(arg, "profile", 7) == 0 && VIM_ISWHITE(arg[7]))
     {
        *compile_type = CT_PROFILE;
@@ -5069,7 +5069,7 @@ ex_defcompile(exarg_T *eap)
 
     if (*eap->arg != NUL)
     {
-       compiletype_T compile_type;
+       compiletype_T compile_type = CT_NONE;
 
        ufunc = find_func_by_name(eap->arg, &compile_type);
        if (ufunc != NULL)
index bde9fe87a5857db398503854bd6c9f6c85d35de2..7cd81892eee6be38f21ce0f92ed445c94b861193 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4992,
 /**/
     4991,
 /**/
index d89f442367a484cfbdd2c9c9e8184a324d93b807..eb07a38c30b386bb2032fd5d67890b8d94ff825c 100644 (file)
@@ -6281,7 +6281,7 @@ ex_disassemble(exarg_T *eap)
     dfunc_T    *dfunc;
     isn_T      *instr;
     int                instr_count;
-    compiletype_T compile_type;
+    compiletype_T compile_type = CT_NONE;
 
     ufunc = find_func_by_name(arg, &compile_type);
     if (ufunc == NULL)