summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-08-08 21:48:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-08-08 21:48:43 (GMT)
commitffdcac4bc59a58fd0c4b99ce2d92c828c5b5fcae (patch)
tree01e383f92f1d88dfd18db94887a09f659ba3b65e /compat
parent17501ba1cd56d4774e59c797bc048ee813dee235 (diff)
parentc6c9e1885c9025f2e4074105e4fbe9b008e5d1a3 (diff)
downloadgit-ffdcac4bc59a58fd0c4b99ce2d92c828c5b5fcae.zip
git-ffdcac4bc59a58fd0c4b99ce2d92c828c5b5fcae.tar.gz
git-ffdcac4bc59a58fd0c4b99ce2d92c828c5b5fcae.tar.bz2
Merge branch 'js/nedmalloc-gcc6-warnings'
Squelch compiler warnings for netmalloc (in compat/) library. * js/nedmalloc-gcc6-warnings: nedmalloc: work around overzealous GCC 6 warning nedmalloc: fix misleading indentation
Diffstat (limited to 'compat')
-rw-r--r--compat/nedmalloc/nedmalloc.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/compat/nedmalloc/nedmalloc.c b/compat/nedmalloc/nedmalloc.c
index a0a16eb..2d4ef59 100644
--- a/compat/nedmalloc/nedmalloc.c
+++ b/compat/nedmalloc/nedmalloc.c
@@ -938,10 +938,10 @@ void **nedpindependent_comalloc(nedpool *p, size_t elems, size_t *sizes, void **
void **ret;
threadcache *tc;
int mymspace;
- size_t i, *adjustedsizes=(size_t *) alloca(elems*sizeof(size_t));
- if(!adjustedsizes) return 0;
- for(i=0; i<elems; i++)
- adjustedsizes[i]=sizes[i]<sizeof(threadcacheblk) ? sizeof(threadcacheblk) : sizes[i];
+ size_t i, *adjustedsizes=(size_t *) alloca(elems*sizeof(size_t));
+ if(!adjustedsizes) return 0;
+ for(i=0; i<elems; i++)
+ adjustedsizes[i]=sizes[i]<sizeof(threadcacheblk) ? sizeof(threadcacheblk) : sizes[i];
GetThreadCache(&p, &tc, &mymspace, 0);
GETMSPACE(m, p, tc, mymspace, 0,
ret=mspace_independent_comalloc(m, elems, adjustedsizes, chunks));
@@ -955,12 +955,11 @@ void **nedpindependent_comalloc(nedpool *p, size_t elems, size_t *sizes, void **
*/
char *strdup(const char *s1)
{
- char *s2 = 0;
- if (s1) {
- size_t len = strlen(s1) + 1;
- s2 = malloc(len);
+ size_t len = strlen(s1) + 1;
+ char *s2 = malloc(len);
+
+ if (s2)
memcpy(s2, s1, len);
- }
return s2;
}
#endif