Skip to content

Commit 6739711

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 223b2d8 + e53a0d4 commit 6739711

21 files changed

Lines changed: 620 additions & 368 deletions

src/alloc.c

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,17 @@ vim_mem_profile_dump(void)
8787
j = 0;
8888
for (i = 0; i < MEM_SIZES - 1; i++)
8989
{
90-
if (mem_allocs[i] || mem_frees[i])
90+
if (mem_allocs[i] == 0 && mem_frees[i] == 0)
91+
continue;
92+
93+
if (mem_frees[i] > mem_allocs[i])
94+
printf("\r\n%s", _("ERROR: "));
95+
printf("[%4d / %4lu-%-4lu] ", i + 1, mem_allocs[i], mem_frees[i]);
96+
j++;
97+
if (j > 3)
9198
{
92-
if (mem_frees[i] > mem_allocs[i])
93-
printf("\r\n%s", _("ERROR: "));
94-
printf("[%4d / %4lu-%-4lu] ", i + 1, mem_allocs[i], mem_frees[i]);
95-
j++;
96-
if (j > 3)
97-
{
98-
j = 0;
99-
printf("\r\n");
100-
}
99+
j = 0;
100+
printf("\r\n");
101101
}
102102
}
103103

@@ -332,22 +332,22 @@ mem_realloc(void *ptr, size_t size)
332332
void
333333
do_outofmem_msg(size_t size)
334334
{
335-
if (!did_outofmem_msg)
336-
{
337-
// Don't hide this message
338-
emsg_silent = 0;
335+
if (did_outofmem_msg)
336+
return;
339337

340-
// Must come first to avoid coming back here when printing the error
341-
// message fails, e.g. when setting v:errmsg.
342-
did_outofmem_msg = TRUE;
338+
// Don't hide this message
339+
emsg_silent = 0;
343340

344-
semsg(_(e_out_of_memory_allocating_nr_bytes), (long_u)size);
341+
// Must come first to avoid coming back here when printing the error
342+
// message fails, e.g. when setting v:errmsg.
343+
did_outofmem_msg = TRUE;
345344

346-
if (starting == NO_SCREEN)
347-
// Not even finished with initializations and already out of
348-
// memory? Then nothing is going to work, exit.
349-
mch_exit(123);
350-
}
345+
semsg(_(e_out_of_memory_allocating_nr_bytes), (long_u)size);
346+
347+
if (starting == NO_SCREEN)
348+
// Not even finished with initializations and already out of
349+
// memory? Then nothing is going to work, exit.
350+
mch_exit(123);
351351
}
352352

353353
#if defined(EXITFREE) || defined(PROTO)
@@ -780,20 +780,20 @@ ga_concat_strings(garray_T *gap, char *sep)
780780
len += (int)STRLEN(((char_u **)(gap->ga_data))[i]) + sep_len;
781781

782782
s = alloc(len + 1);
783-
if (s != NULL)
783+
if (s == NULL)
784+
return NULL;
785+
786+
*s = NUL;
787+
p = s;
788+
for (i = 0; i < gap->ga_len; ++i)
784789
{
785-
*s = NUL;
786-
p = s;
787-
for (i = 0; i < gap->ga_len; ++i)
790+
if (p != s)
788791
{
789-
if (p != s)
790-
{
791-
STRCPY(p, sep);
792-
p += sep_len;
793-
}
794-
STRCPY(p, ((char_u **)(gap->ga_data))[i]);
795-
p += STRLEN(p);
792+
STRCPY(p, sep);
793+
p += sep_len;
796794
}
795+
STRCPY(p, ((char_u **)(gap->ga_data))[i]);
796+
p += STRLEN(p);
797797
}
798798
return s;
799799
}

0 commit comments

Comments
 (0)