shithub: libmujs

Download patch

ref: 71ffe074957b3bf4f12bf79ec9b16297a4557b66
parent: 88b31f342d3b159c8f6b83c5f1c26b04060b6838
author: Tor Andersson <tor.andersson@artifex.com>
date: Thu Dec 1 05:18:16 EST 2022

Fix longjmp warnings.

--- a/jsarray.c
+++ b/jsarray.c
@@ -64,8 +64,8 @@
 static void Ap_join(js_State *J)
 {
 	char * volatile out = NULL;
+	const char * volatile r = NULL;
 	const char *sep;
-	const char *r;
 	int seplen;
 	int k, n, len, rlen;
 
--- a/pp.c
+++ b/pp.c
@@ -75,6 +75,17 @@
 	fclose(f);
 }
 
+static void js_tryppfile(js_State *J, const char *file, int minify)
+{
+	if (js_try(J)) {
+		js_report(J, js_trystring(J, -1, "Error"));
+		js_pop(J, 1);
+		return;
+	}
+	js_ppfile(J, file, minify);
+	js_endtry(J);
+}
+
 int
 main(int argc, char **argv)
 {
@@ -91,15 +102,8 @@
 			minify = 2;
 		else if (!strcmp(argv[i], "-s"))
 			minify = 3;
-		else {
-			if (js_try(J)) {
-				js_report(J, js_trystring(J, -1, "Error"));
-				js_pop(J, 1);
-				continue;
-			}
-			js_ppfile(J, argv[i], minify);
-			js_endtry(J);
-		}
+		else
+			js_tryppfile(J, argv[i], minify);
 	}
 
 	js_gc(J, 0);