Assert that vim_strsize and vim_strnsize gets a non-null parameter.

This commit is contained in:
Simen Endsjø 2014-03-02 19:37:37 +01:00 committed by Thiago de Arruda
parent 34538a82f3
commit d3be9f3796

View File

@ -600,6 +600,8 @@ int ptr2cells(char_u *p)
/*
* Return the number of character cells string "s" will take on the screen,
* counting TABs as two characters: "^I".
*
* 's' must be non-null.
*/
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
* screen, counting TABs as two characters: "^I".
*
* 's' must be non-null.
*/
int vim_strnsize(char_u *s, int len)
{
assert(s);
int size = 0;
while (*s != NUL && --len >= 0) {