Make a smaller diff which makes this work on NetBSD/macppc.

This commit is contained in:
Havard Eidnes 2019-07-14 00:52:36 +02:00
parent a08a5b97b2
commit bff35bf7d3
2 changed files with 4 additions and 46 deletions

View File

@ -6,7 +6,7 @@ SHA512 (quickjs-2019-07-09.tar.xz) = db2498659ae1c22e5c0a24e0f2d582db6003e18a182
Size (quickjs-2019-07-09.tar.xz) = 737248 bytes
SHA1 (patch-Makefile) = d96c2a797bb9bc7becc7f1217fc3d3457527d55f
SHA1 (patch-cutils.h) = 9719a77add566ce6443af1ac2ba1d1ea61e5c248
SHA1 (patch-libregexp.c) = 3ef3f22022d8d791b88d376ff426c4d41fc2eeb3
SHA1 (patch-libregexp.c) = f22297908deae0a04625478ba6c0134cbb3394a8
SHA1 (patch-qjs.c) = d26b8ac0f7bf84bdb17fb4784f637dcb012cbd93
SHA1 (patch-qjsc.c) = 58733721d4e4647737d111e8835b4c1016ea2889
SHA1 (patch-quickjs-libc.c) = 2257ad069d9a9232d6a3e1c5ae0530d08a1b1010

View File

@ -5,62 +5,20 @@ as negative values when cast to intptr_t.
--- libregexp.c.orig 2019-07-09 17:49:47.000000000 +0000
+++ libregexp.c
@@ -2027,8 +2027,9 @@ static int push_state(REExecContext *s,
@@ -2027,6 +2027,7 @@ static int push_state(REExecContext *s,
return 0;
}
+/* Comment is misleading: can also return int'ed pointer */
/* return 1 if match, 0 if not match or -1 if error. */
-static intptr_t lre_exec_backtrack(REExecContext *s, uint8_t **capture,
+static uintptr_t lre_exec_backtrack(REExecContext *s, uint8_t **capture,
static intptr_t lre_exec_backtrack(REExecContext *s, uint8_t **capture,
StackInt *stack, int stack_len,
const uint8_t *pc, const uint8_t *cptr,
BOOL no_recurse)
@@ -2049,7 +2050,7 @@ static intptr_t lre_exec_backtrack(REExe
{
REExecState *rs;
if (no_recurse)
- return (intptr_t)cptr;
+ return (uintptr_t)cptr;
ret = 1;
goto recurse;
no_match:
@@ -2393,7 +2394,7 @@ static intptr_t lre_exec_backtrack(REExe
{
uint32_t next_pos, quant_min, quant_max;
size_t q;
- intptr_t res;
+ uintptr_t res;
const uint8_t *pc1;
next_pos = get_u32(pc);
@@ -2407,7 +2408,7 @@ static intptr_t lre_exec_backtrack(REExe
for(;;) {
res = lre_exec_backtrack(s, capture, stack, stack_len,
pc1, cptr, TRUE);
- if (res < 0)
+ if (res == (uintptr_t)-1)
+ if (res == -1)
return res;
if (!res)
break;
@@ -2443,7 +2444,8 @@ int lre_exec(uint8_t **capture,
int cbuf_type, void *opaque)
{
REExecContext s_s, *s = &s_s;
- int re_flags, i, alloca_size, ret;
+ int re_flags, i, alloca_size;
+ uintptr_t ret;
StackInt *stack_buf;
re_flags = bc_buf[RE_HEADER_FLAGS];
@@ -2473,7 +2475,9 @@ int lre_exec(uint8_t **capture,
ret = lre_exec_backtrack(s, capture, stack_buf, 0, bc_buf + RE_HEADER_LEN,
cbuf + (cindex << cbuf_type), FALSE);
lre_realloc(s->opaque, s->state_stack, 0);
- return ret;
+ if (ret == (uintptr_t)-1)
+ return -1;
+ return (int)ret;
}
int lre_get_capture_count(const uint8_t *bc_buf)