summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReuben Thomas <rrt@sc3d.org>2012-09-29 16:34:08 +0100
committerReuben Thomas <rrt@sc3d.org>2012-09-29 16:34:08 +0100
commit414a1d037989d12af148396eadb175b2d6491114 (patch)
tree33624c88373b2f5406832bbb4c0eb71cca811b62
parentbcafc078ff3de4b6fe57a480dacbe33ae41ce84d (diff)
downloadlrexlib-414a1d037989d12af148396eadb175b2d6491114.tar.gz
lposix.c: fold CheckStartEnd into its only caller
-rw-r--r--src/posix/lposix.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/src/posix/lposix.c b/src/posix/lposix.c
index 513ea31..77fa761 100644
--- a/src/posix/lposix.c
+++ b/src/posix/lposix.c
@@ -117,18 +117,6 @@ static int compile_regex (lua_State *L, const TArgComp *argC, TPosix **pud) {
return 1;
}
-#ifdef REG_STARTEND
-static void CheckStartEnd (TArgExec *argE, TPosix *ud) {
- if (argE->eflags & REG_STARTEND) {
- ud->match[0].rm_so = argE->startoffset;
- ud->match[0].rm_eo = argE->textlen;
- argE->startoffset = 0;
- }
- else
- argE->text += argE->startoffset;
-}
-#endif
-
static int gmatch_exec (TUserdata *ud, TArgExec *argE) {
if (argE->startoffset > 0)
argE->eflags |= REG_NOTBOL;
@@ -155,10 +143,14 @@ static void gmatch_pushsubject (lua_State *L, TArgExec *argE) {
static int findmatch_exec (TPosix *ud, TArgExec *argE) {
#ifdef REG_STARTEND
- CheckStartEnd (argE, ud);
-#else
- argE->text += argE->startoffset;
+ if (argE->eflags & REG_STARTEND) {
+ ud->match[0].rm_so = argE->startoffset;
+ ud->match[0].rm_eo = argE->textlen;
+ argE->startoffset = 0;
+ }
+ else
#endif
+ argE->text += argE->startoffset;
return regexec (&ud->r, argE->text, ALG_NSUB(ud) + 1, ud->match, argE->eflags);
}