changeset 32164:673dcbaded32 v9.0.1413

patch 9.0.1413: compiler warning for unused variable Commit: https://github.com/vim/vim/commit/2a003177eb3cee535bb8a384b4b87db13f0486ae Author: Bram Moolenaar <Bram@vim.org> Date: Fri Mar 17 18:50:48 2023 +0000 patch 9.0.1413: compiler warning for unused variable Problem: Compiler warning for unused variable. Solution: Move variable declaration. (John Marriott)
author Bram Moolenaar <Bram@vim.org>
date Fri, 17 Mar 2023 20:00:06 +0100
parents e23efcbde488
children 4e6cc56ca41c
files src/time.c src/version.c
diffstat 2 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/time.c
+++ b/src/time.c
@@ -258,24 +258,21 @@ f_reltimefloat(typval_T *argvars UNUSED,
     void
 f_reltimestr(typval_T *argvars UNUSED, typval_T *rettv)
 {
-    static char buf[50];
-# ifdef FEAT_RELTIME
-    proftime_T	tm;
-# endif
-
     rettv->v_type = VAR_STRING;
     rettv->vval.v_string = NULL;
 # ifdef FEAT_RELTIME
     if (in_vim9script() && check_for_list_arg(argvars, 0) == FAIL)
 	return;
 
+    proftime_T	tm;
     if (list2proftime(&argvars[0], &tm) == OK)
     {
 # ifdef MSWIN
 	rettv->vval.v_string = vim_strsave((char_u *)profile_msg(&tm));
 # else
+	static char buf[50];
 	long usec = tm.tv_fsec / (TV_FSEC_SEC / 1000000);
-	sprintf(buf, "%3ld.%06ld", (long)tm.tv_sec, usec);
+	vim_snprintf(buf, sizeof(buf), "%3ld.%06ld", (long)tm.tv_sec, usec);
 	rettv->vval.v_string = vim_strsave((char_u *)buf);
 # endif
     }
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1413,
+/**/
     1412,
 /**/
     1411,