mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 9.0.0386: some code blocks are nested too deep
Problem: Some code blocks are nested too deep. Solution: Bail out earlier. (Yegappan Lakshmanan, closes #11058)
This commit is contained in:
committed by
Bram Moolenaar
parent
c47b16a470
commit
b1f471ee20
68
src/alloc.c
68
src/alloc.c
@@ -87,17 +87,17 @@ vim_mem_profile_dump(void)
|
||||
j = 0;
|
||||
for (i = 0; i < MEM_SIZES - 1; i++)
|
||||
{
|
||||
if (mem_allocs[i] || mem_frees[i])
|
||||
if (mem_allocs[i] == 0 && mem_frees[i] == 0)
|
||||
continue;
|
||||
|
||||
if (mem_frees[i] > mem_allocs[i])
|
||||
printf("\r\n%s", _("ERROR: "));
|
||||
printf("[%4d / %4lu-%-4lu] ", i + 1, mem_allocs[i], mem_frees[i]);
|
||||
j++;
|
||||
if (j > 3)
|
||||
{
|
||||
if (mem_frees[i] > mem_allocs[i])
|
||||
printf("\r\n%s", _("ERROR: "));
|
||||
printf("[%4d / %4lu-%-4lu] ", i + 1, mem_allocs[i], mem_frees[i]);
|
||||
j++;
|
||||
if (j > 3)
|
||||
{
|
||||
j = 0;
|
||||
printf("\r\n");
|
||||
}
|
||||
j = 0;
|
||||
printf("\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,22 +332,22 @@ mem_realloc(void *ptr, size_t size)
|
||||
void
|
||||
do_outofmem_msg(size_t size)
|
||||
{
|
||||
if (!did_outofmem_msg)
|
||||
{
|
||||
// Don't hide this message
|
||||
emsg_silent = 0;
|
||||
if (did_outofmem_msg)
|
||||
return;
|
||||
|
||||
// Must come first to avoid coming back here when printing the error
|
||||
// message fails, e.g. when setting v:errmsg.
|
||||
did_outofmem_msg = TRUE;
|
||||
// Don't hide this message
|
||||
emsg_silent = 0;
|
||||
|
||||
semsg(_(e_out_of_memory_allocating_nr_bytes), (long_u)size);
|
||||
// Must come first to avoid coming back here when printing the error
|
||||
// message fails, e.g. when setting v:errmsg.
|
||||
did_outofmem_msg = TRUE;
|
||||
|
||||
if (starting == NO_SCREEN)
|
||||
// Not even finished with initializations and already out of
|
||||
// memory? Then nothing is going to work, exit.
|
||||
mch_exit(123);
|
||||
}
|
||||
semsg(_(e_out_of_memory_allocating_nr_bytes), (long_u)size);
|
||||
|
||||
if (starting == NO_SCREEN)
|
||||
// Not even finished with initializations and already out of
|
||||
// memory? Then nothing is going to work, exit.
|
||||
mch_exit(123);
|
||||
}
|
||||
|
||||
#if defined(EXITFREE) || defined(PROTO)
|
||||
@@ -780,20 +780,20 @@ ga_concat_strings(garray_T *gap, char *sep)
|
||||
len += (int)STRLEN(((char_u **)(gap->ga_data))[i]) + sep_len;
|
||||
|
||||
s = alloc(len + 1);
|
||||
if (s != NULL)
|
||||
if (s == NULL)
|
||||
return NULL;
|
||||
|
||||
*s = NUL;
|
||||
p = s;
|
||||
for (i = 0; i < gap->ga_len; ++i)
|
||||
{
|
||||
*s = NUL;
|
||||
p = s;
|
||||
for (i = 0; i < gap->ga_len; ++i)
|
||||
if (p != s)
|
||||
{
|
||||
if (p != s)
|
||||
{
|
||||
STRCPY(p, sep);
|
||||
p += sep_len;
|
||||
}
|
||||
STRCPY(p, ((char_u **)(gap->ga_data))[i]);
|
||||
p += STRLEN(p);
|
||||
STRCPY(p, sep);
|
||||
p += sep_len;
|
||||
}
|
||||
STRCPY(p, ((char_u **)(gap->ga_data))[i]);
|
||||
p += STRLEN(p);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
Reference in New Issue
Block a user