shithub: libmujs

Download patch

ref: 35cc749225516c14183ffc5e8bbde35ee6a560b0
parent: d608b2f9aac161e05ee0a97d7d786b6da16dbb0d
author: Tor Andersson <tor@ccxvii.net>
date: Thu Mar 6 16:20:53 EST 2014

Fix regex.c test function printouts.

--- a/regex.c
+++ b/regex.c
@@ -1121,7 +1121,10 @@
 			if (!regexec(p, s, &m, 0)) {
 				for (i = 0; i < m.nsub; ++i) {
 					int n = m.sub[i].ep - m.sub[i].sp;
-					printf("match %d: s=%d e=%d n=%d '%.*s'\n", i, (int)(m.sub[i].sp - s), (int)(m.sub[i].ep - s), n, n, m.sub[i].sp);
+					if (n > 0)
+						printf("match %d: s=%d e=%d n=%d '%.*s'\n", i, (int)(m.sub[i].sp - s), (int)(m.sub[i].ep - s), n, n, m.sub[i].sp);
+					else
+						printf("match %d: n=0 ''\n", i);
 				}
 			} else {
 				printf("no match\n");