Commit 89c5bef0 authored by Thibault Ferrante's avatar Thibault Ferrante Committed by Leo

main/luajit: fix gsub issue

See https://github.com/moonjit/moonjit/issues/86
parent 53cb6396
Pipeline #35640 skipped
see https://github.com/moonjit/moonjit/issues/86
Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
---
src/lib_string.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/lib_string.c b/src/lib_string.c
index 5e2891a9e..a90e189ba 100644
--- a/src/lib_string.c
+++ b/src/lib_string.c
@@ -621,7 +621,7 @@ LJLIB_CF(string_gsub)
const char *p = luaL_checklstring(L, 2, &lp);
int tr = lua_type(L, 3);
int max_s = luaL_optint(L, 4, (int)(srcl+1));
- int anchor = (*p == '^') ? (p++, 1) : 0;
+ int anchor = (*p == '^');
int n = 0;
MatchState ms;
luaL_Buffer b;
@@ -629,6 +629,9 @@ LJLIB_CF(string_gsub)
tr == LUA_TFUNCTION || tr == LUA_TTABLE))
lj_err_arg(L, 3, LJ_ERR_NOSFT);
luaL_buffinit(L, &b);
+ if (anchor) {
+ p++; lp--; /* skip anchor character */
+ }
ms.L = L;
ms.src_init = src;
ms.src_end = src+srcl;
......@@ -3,7 +3,7 @@
pkgname=luajit
_pkgname=moonjit
pkgver=2.2.0
pkgrel=1
pkgrel=2
pkgdesc="Integration fork of the original LuaJIT"
url="https://github.com/moonjit/moonjit"
arch="all"
......@@ -11,7 +11,8 @@ license="MIT"
provides="lua"
subpackages="$pkgname-dev $pkgname-doc"
source="$_pkgname-$pkgver.tar.gz::https://github.com/moonjit/moonjit/archive/$pkgver.tar.gz
10-module-paths.patch"
10-module-paths.patch
20-src-lib_string.patch"
builddir="$srcdir/$_pkgname-$pkgver"
build() {
......@@ -41,4 +42,5 @@ package() {
}
sha512sums="a940dd9973801f7067e376d62ec70ab5fbf635f59c648dcb45072f55290a6752abb3b1fa307bdd81d4bf05c719338e8fbda143f62861c61cb66b34cc9e8e7d54 moonjit-2.2.0.tar.gz
9c6c410e142838c5128c70570e66beb53cc5422df5ecfb8ab0b5f362637b21ab5978c00f19bc1759165df162fd6438a2ed43e25020400011b7bb14014d87c62e 10-module-paths.patch"
9c6c410e142838c5128c70570e66beb53cc5422df5ecfb8ab0b5f362637b21ab5978c00f19bc1759165df162fd6438a2ed43e25020400011b7bb14014d87c62e 10-module-paths.patch
9d87e944580fe7a3c24e043012dbdacf5141bafb5ea83dc141c42f6641b8df117d1779c3c50ee9fccc58e625a0bc04c64dd75ab0c1815bbbf2a2e645ec0ff85e 20-src-lib_string.patch"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment