mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 22:18:33 +00:00
Assert that vim_strsize and vim_strnsize gets a non-null parameter.
This commit is contained in:

committed by
Thiago de Arruda

parent
34538a82f3
commit
d3be9f3796
@@ -600,6 +600,8 @@ int ptr2cells(char_u *p)
|
|||||||
/*
|
/*
|
||||||
* Return the number of character cells string "s" will take on the screen,
|
* Return the number of character cells string "s" will take on the screen,
|
||||||
* counting TABs as two characters: "^I".
|
* counting TABs as two characters: "^I".
|
||||||
|
*
|
||||||
|
* 's' must be non-null.
|
||||||
*/
|
*/
|
||||||
int vim_strsize(char_u *s)
|
int vim_strsize(char_u *s)
|
||||||
{
|
{
|
||||||
@@ -609,9 +611,12 @@ int vim_strsize(char_u *s)
|
|||||||
/*
|
/*
|
||||||
* Return the number of character cells string "s[len]" will take on the
|
* Return the number of character cells string "s[len]" will take on the
|
||||||
* screen, counting TABs as two characters: "^I".
|
* screen, counting TABs as two characters: "^I".
|
||||||
|
*
|
||||||
|
* 's' must be non-null.
|
||||||
*/
|
*/
|
||||||
int vim_strnsize(char_u *s, int len)
|
int vim_strnsize(char_u *s, int len)
|
||||||
{
|
{
|
||||||
|
assert(s);
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
|
||||||
while (*s != NUL && --len >= 0) {
|
while (*s != NUL && --len >= 0) {
|
||||||
|
Reference in New Issue
Block a user