diff src/userfunc.c @ 28940:b02044bc8c20 v8.2.4992

patch 8.2.4992: compiler warning for possibly uninitialized variable Commit: https://github.com/vim/vim/commit/5a01caa90428a5f87600528d68529383c0b2f78c Author: Bram Moolenaar <Bram@vim.org> Date: Sat May 21 18:56:58 2022 +0100 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.
author Bram Moolenaar <Bram@vim.org>
date Sat, 21 May 2022 20:00:03 +0200
parents 5a34620140c0
children e391590249a1
line wrap: on
line diff
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -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, compilet
     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)