summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-05-09 13:06:24 +0200
committerBram Moolenaar <Bram@vim.org>2020-05-09 13:06:24 +0200
commit7d3664df9008bd5f39f8a2555843d1b269946e4d (patch)
treee2566a0619969a3c98d159a124e4df3fec2627c5
parent7d131b071539e73e4f8a1e6ffbb4d7bfc69a57ec (diff)
downloadvim-git-7d3664df9008bd5f39f8a2555843d1b269946e4d.tar.gz
patch 8.2.0718: gcc warning for returning pointer to local variablev8.2.0718
Problem: Gcc warning for returning pointer to local variable. (John Marriott) Solution: Return another pointer.
-rw-r--r--src/evalvars.c4
-rw-r--r--src/version.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/src/evalvars.c b/src/evalvars.c
index 08b2990bc..0935bb3eb 100644
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -2510,6 +2510,7 @@ lookup_scriptvar(char_u *name, size_t len, cctx_T *dummy UNUSED)
return NULL;
if (len < sizeof(buffer) - 1)
{
+ // avoid an alloc/free for short names
vim_strncpy(buffer, name, len);
p = buffer;
}
@@ -2529,7 +2530,8 @@ lookup_scriptvar(char_u *name, size_t len, cctx_T *dummy UNUSED)
if (p != buffer)
vim_free(p);
- return res;
+ // Don't return "buffer", gcc complains.
+ return res == NULL ? NULL : IObuff;
}
/*
diff --git a/src/version.c b/src/version.c
index ba81d6809..5c54b428e 100644
--- a/src/version.c
+++ b/src/version.c
@@ -747,6 +747,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 718,
+/**/
717,
/**/
716,