ga_growsize should be >= 1

I know it could be 0 sometimes. Running the tests with
`assert(gap->ga_growsize > 0)` in ga_grow() crashes nvim while running the
tests.

 - Add a setter for ga_growsize that checks whether the value passed is >=1 (log
	 in case it's not)
 - log when ga_grow() tries to use a ga_growsize that's not >=1
 - use GA_EMPTY_INIT_VALUE is many places
This commit is contained in:
Felipe Oliveira Carvalho
2014-06-09 00:02:50 -03:00
committed by Justin M. Keyes
parent d723e7fd61
commit be3a4b6ca8
11 changed files with 51 additions and 28 deletions

View File

@@ -2257,8 +2257,8 @@ void mch_errmsg(char *str)
emsg_on_display = FALSE;
len = (int)STRLEN(str) + 1;
if (error_ga.ga_growsize == 0) {
error_ga.ga_growsize = 80;
if (error_ga.ga_data == NULL) {
ga_set_growsize(&error_ga, 80);
error_ga.ga_itemsize = 1;
}
ga_grow(&error_ga, len);