shithub: libmujs

Download patch

ref: 7e00def3c3c79534f1368a0b5bc0697b19683e60
parent: 336097c57fcf5275ab84feab383ecf7773c7ec85
author: Tor Andersson <tor.andersson@gmail.com>
date: Fri Jan 20 09:36:34 EST 2017

Fix 697486: Workaround non-c99 compilers griping about trailing commas.

--- a/jsdump.c
+++ b/jsdump.c
@@ -9,15 +9,17 @@
 
 static const char *astname[] = {
 #include "astnames.h"
+NULL
 };
 
 static const char *opname[] = {
 #include "opnames.h"
+NULL
 };
 
 const char *jsP_aststring(enum js_AstType type)
 {
-	if (type < nelem(astname))
+	if (type < nelem(astname)-1)
 		return astname[type];
 	return "<unknown>";
 }
@@ -24,7 +26,7 @@
 
 const char *jsC_opcodestring(enum js_OpCode opcode)
 {
-	if (opcode < nelem(opname))
+	if (opcode < nelem(opname)-1)
 		return opname[opcode];
 	return "<unknown>";
 }