mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -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;
|
||||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user