shithub: libmujs

Download patch

ref: 89dc0c8cd1e3729cd579fbb179db9db1ac9f944b
parent: 9e41afffa65f4c42aa7e68ddb2ffcacaadaa32ed
author: Tor Andersson <[email protected]>
date: Wed Mar 26 09:09:53 EDT 2014

Fix warnings on Windows.

Call js_realloc, not realloc.

4 warnings remain due to the constnes of js_func strtab and vartab
entries.

--- a/jscompile.c
+++ b/jscompile.c
@@ -55,7 +55,7 @@
 {
 	if (F->codelen >= F->codecap) {
 		F->codecap = F->codecap ? F->codecap * 2 : 64;
-		F->code = realloc(F->code, F->codecap * sizeof *F->code);
+		F->code = js_realloc(J, F->code, F->codecap * sizeof *F->code);
 	}
 	F->code[F->codelen++] = value;
 }
@@ -69,7 +69,7 @@
 {
 	if (F->funlen >= F->funcap) {
 		F->funcap = F->funcap ? F->funcap * 2 : 16;
-		F->funtab = realloc(F->funtab, F->funcap * sizeof *F->funtab);
+		F->funtab = js_realloc(J, F->funtab, F->funcap * sizeof *F->funtab);
 	}
 	F->funtab[F->funlen] = value;
 	return F->funlen++;
@@ -83,7 +83,7 @@
 			return i;
 	if (F->numlen >= F->numcap) {
 		F->numcap = F->numcap ? F->numcap * 2 : 16;
-		F->numtab = realloc(F->numtab, F->numcap * sizeof *F->numtab);
+		F->numtab = js_realloc(J, F->numtab, F->numcap * sizeof *F->numtab);
 	}
 	F->numtab[F->numlen] = value;
 	return F->numlen++;
@@ -97,7 +97,7 @@
 			return i;
 	if (F->strlen >= F->strcap) {
 		F->strcap = F->strcap ? F->strcap * 2 : 16;
-		F->strtab = realloc(F->strtab, F->strcap * sizeof *F->strtab);
+		F->strtab = js_realloc(J, F->strtab, F->strcap * sizeof *F->strtab);
 	}
 	F->strtab[F->strlen] = value;
 	return F->strlen++;
@@ -113,7 +113,7 @@
 	}
 	if (F->varlen >= F->varcap) {
 		F->varcap = F->varcap ? F->varcap * 2 : 16;
-		F->vartab = realloc(F->vartab, F->varcap * sizeof *F->vartab);
+		F->vartab = js_realloc(J, F->vartab, F->varcap * sizeof *F->vartab);
 	}
 	F->vartab[F->varlen++] = name;
 }
--- a/jsdtoa.c
+++ b/jsdtoa.c
@@ -142,7 +142,7 @@
 	 * can't get here.  the number a is always normalized
 	 * so that it has a nonzero first digit.
 	 */
-	abort();
+	return 0;
 }
 
 /*