mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
refactor: add xmemcpyz() and use it in place of some xstrlcpy() (#28422)
Problem: Using xstrlcpy() when the exact length of the string to be copied is known is not ideal because it requires adding 1 to the length and an unnecessary strlen(). Solution: Add xmemcpyz() and use it in place of such xstrlcpy() calls.
This commit is contained in:
@@ -1989,12 +1989,12 @@ def CheckLanguage(filename, clean_lines, linenum, error):
|
||||
match = Search(r'\b(strncpy|STRNCPY)\b', line)
|
||||
if match:
|
||||
error(filename, linenum, 'runtime/printf', 4,
|
||||
'Use xstrlcpy or snprintf instead of %s (unless this is from Vim)'
|
||||
'Use xstrlcpy, xmemcpyz or snprintf instead of %s (unless this is from Vim)'
|
||||
% match.group(1))
|
||||
match = Search(r'\b(strcpy)\b', line)
|
||||
if match:
|
||||
error(filename, linenum, 'runtime/printf', 4,
|
||||
'Use xstrlcpy or snprintf instead of %s' % match.group(1))
|
||||
'Use xstrlcpy, xmemcpyz or snprintf instead of %s' % match.group(1))
|
||||
match = Search(r'\b(STRNCAT|strncat|strcat|vim_strcat)\b', line)
|
||||
if match:
|
||||
error(filename, linenum, 'runtime/printf', 4,
|
||||
|
Reference in New Issue
Block a user