mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.0718: gcc warning for returning pointer to local variable
Problem: Gcc warning for returning pointer to local variable. (John Marriott) Solution: Return another pointer.
This commit is contained in:
@@ -2510,6 +2510,7 @@ lookup_scriptvar(char_u *name, size_t len, cctx_T *dummy UNUSED)
|
|||||||
return NULL;
|
return NULL;
|
||||||
if (len < sizeof(buffer) - 1)
|
if (len < sizeof(buffer) - 1)
|
||||||
{
|
{
|
||||||
|
// avoid an alloc/free for short names
|
||||||
vim_strncpy(buffer, name, len);
|
vim_strncpy(buffer, name, len);
|
||||||
p = buffer;
|
p = buffer;
|
||||||
}
|
}
|
||||||
@@ -2529,7 +2530,8 @@ lookup_scriptvar(char_u *name, size_t len, cctx_T *dummy UNUSED)
|
|||||||
|
|
||||||
if (p != buffer)
|
if (p != buffer)
|
||||||
vim_free(p);
|
vim_free(p);
|
||||||
return res;
|
// Don't return "buffer", gcc complains.
|
||||||
|
return res == NULL ? NULL : IObuff;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -746,6 +746,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
718,
|
||||||
/**/
|
/**/
|
||||||
717,
|
717,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user