Skip to content

Commit b31baa7

Browse files
committed
Merge branch 'js/nedmalloc-gcc6-warnings' into next
Squelch compiler warnings for netmalloc (in compat/) library. * js/nedmalloc-gcc6-warnings: nedmalloc: work around overzealous GCC 6 warning nedmalloc: fix misleading indentation
2 parents 897e986 + c6c9e18 commit b31baa7

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

compat/nedmalloc/nedmalloc.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -938,10 +938,10 @@ void **nedpindependent_comalloc(nedpool *p, size_t elems, size_t *sizes, void **
938938
void **ret;
939939
threadcache *tc;
940940
int mymspace;
941-
size_t i, *adjustedsizes=(size_t *) alloca(elems*sizeof(size_t));
942-
if(!adjustedsizes) return 0;
943-
for(i=0; i<elems; i++)
944-
adjustedsizes[i]=sizes[i]<sizeof(threadcacheblk) ? sizeof(threadcacheblk) : sizes[i];
941+
size_t i, *adjustedsizes=(size_t *) alloca(elems*sizeof(size_t));
942+
if(!adjustedsizes) return 0;
943+
for(i=0; i<elems; i++)
944+
adjustedsizes[i]=sizes[i]<sizeof(threadcacheblk) ? sizeof(threadcacheblk) : sizes[i];
945945
GetThreadCache(&p, &tc, &mymspace, 0);
946946
GETMSPACE(m, p, tc, mymspace, 0,
947947
ret=mspace_independent_comalloc(m, elems, adjustedsizes, chunks));
@@ -955,12 +955,11 @@ void **nedpindependent_comalloc(nedpool *p, size_t elems, size_t *sizes, void **
955955
*/
956956
char *strdup(const char *s1)
957957
{
958-
char *s2 = 0;
959-
if (s1) {
960-
size_t len = strlen(s1) + 1;
961-
s2 = malloc(len);
958+
size_t len = strlen(s1) + 1;
959+
char *s2 = malloc(len);
960+
961+
if (s2)
962962
memcpy(s2, s1, len);
963-
}
964963
return s2;
965964
}
966965
#endif

0 commit comments

Comments
 (0)