diff options
author | Larry Wall <lwall@jpl-devvax.jpl.nasa.gov> | 1990-10-19 13:31:07 +0000 |
---|---|---|
committer | Larry Wall <lwall@jpl-devvax.jpl.nasa.gov> | 1990-10-19 13:31:07 +0000 |
commit | e5d73d7778736a8bd9f7f44aad5289ad2c783a16 (patch) | |
tree | 756f3b46679d7ac7f679ae75de0329852e1155b2 /regcomp.c | |
parent | 20188a906a3fc8fea4839293454a6ca32aa362cc (diff) | |
download | perl-e5d73d7778736a8bd9f7f44aad5289ad2c783a16.tar.gz |
perl 3.0 patch #37 (combined patch)
I tried to take the strlen of an integer on systems without wait4()
or waitpid(). For some reason this didn't work too well...
In hash.c there was a call to dbm_nextkey() which needed to be
ifdefed on old dbm systems.
A pattern such as /foo.*bar$/ was wrongly optimized to do
tail matching on "foo". This was a longstanding bug that
was unmasked by patch 36.
Some systems have some SYS V IPC but not all of it. Configure
now figures this out.
Patch 36 put the user's PATH in front of Configures, but to make
it work right I needed to change all calls of loc to ./loc in
Configure.
$cryptlib needed to be mentioned in the Makefile.
Apollo 10.3 and Sun 3.5 have some compilation problems, so I
mentioned them in README.
Cray has weird restrictions on setjmp locations--you can't say
if (result = setjmp(...))
Random typos and cleanup.
Diffstat (limited to 'regcomp.c')
-rw-r--r-- | regcomp.c | 25 |
1 files changed, 19 insertions, 6 deletions
@@ -7,9 +7,12 @@ * blame Henry for some of the lack of readability. */ -/* $Header: regcomp.c,v 3.0.1.6 90/10/16 10:17:33 lwall Locked $ +/* $Header: regcomp.c,v 3.0.1.7 90/10/20 02:18:32 lwall Locked $ * * $Log: regcomp.c,v $ + * Revision 3.0.1.7 90/10/20 02:18:32 lwall + * patch37: /foo.*bar$/ wrongly optimized to do tail matching on "foo" + * * Revision 3.0.1.6 90/10/16 10:17:33 lwall * patch29: patterns with multiple short literal strings sometimes failed * @@ -250,7 +253,7 @@ int fold; len = 0; curback = 0; back = 0; - while (scan != NULL) { + while (OP(scan) != END) { if (OP(scan) == BRANCH) { if (OP(regnext(scan)) == BRANCH) { curback = -30000; @@ -288,13 +291,22 @@ int fold; str_sset(longest,longish); str_nset(longish,"",0); } - else if (index(simple,OP(scan))) + else if (index(simple,OP(scan))) { curback++; + len = 0; + if (longish->str_cur > longest->str_cur) + str_sset(longest,longish); + str_nset(longish,"",0); + } scan = regnext(scan); } - if (longish->str_cur > longest->str_cur) + + /* Prefer earlier on tie, unless we can tail match latter */ + + if (longish->str_cur + (OP(first) == EOL) > longest->str_cur) str_sset(longest,longish); - str_free(longish); + else + str_nset(longish,"",0); if (longest->str_cur) { r->regmust = longest; if (back < 0) @@ -304,11 +316,12 @@ int fold; > !(sawstudy || fold || OP(first) == EOL) ) fbmcompile(r->regmust,fold); r->regmust->str_u.str_useful = 100; - if (OP(first) == EOL) /* is match anchored to EOL? */ + if (OP(first) == EOL && longish->str_cur) r->regmust->str_pok |= SP_TAIL; } else str_free(longest); + str_free(longish); } r->do_folding = fold; |