]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.1413: compiler warning for unused variable v9.0.1413
authorBram Moolenaar <Bram@vim.org>
Fri, 17 Mar 2023 18:50:48 +0000 (18:50 +0000)
committerBram Moolenaar <Bram@vim.org>
Fri, 17 Mar 2023 18:50:48 +0000 (18:50 +0000)
Problem:    Compiler warning for unused variable.
Solution:   Move variable declaration. (John Marriott)

src/time.c
src/version.c

index bcc7eef1396092745bfeff49f3729e7035a714bb..62b38b4bf9bee35b736c06de5d6569524a991cfa 100644 (file)
@@ -258,24 +258,21 @@ f_reltimefloat(typval_T *argvars UNUSED, typval_T *rettv)
     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
     }
index f0a816f57734d63a8566935fa1d962ba64246059..98369f6837e264c90b47f6ce0b88960d568bd6dc 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1413,
 /**/
     1412,
 /**/