summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@khw-desktop.(none)>2010-07-25 13:13:10 -0600
committerRafael Garcia-Suarez <rgs@consttype.org>2010-07-27 09:42:01 +0200
commit454155d98d52c903969d4c71a5cd1f2f269aaf5f (patch)
tree1eac25e5f85dd8b517e82387bb6f392022be8732 /regcomp.c
parent154bd5274ebc449c2a37261db17c2e721d16078d (diff)
downloadperl-454155d98d52c903969d4c71a5cd1f2f269aaf5f.tar.gz
Change function signature of grok_bslash_o
The previous return value where NULL meant OK is outside-the-norm.
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/regcomp.c b/regcomp.c
index 1cc2e10064..43b881db19 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -7360,7 +7360,6 @@ tryagain:
register UV ender;
register char *p;
char *s;
- char *error_msg;
STRLEN foldlen;
U8 tmpbuf[UTF8_MAXBYTES_CASE+1], *foldbuf;
@@ -7465,19 +7464,23 @@ tryagain:
{
STRLEN brace_len = len;
UV result;
- if ((error_msg = grok_bslash_o(p,
- &result,
- &brace_len,
- SIZE_ONLY))
- != NULL)
- {
+ const char* error_msg;
+
+ bool valid = grok_bslash_o(p,
+ &result,
+ &brace_len,
+ &error_msg,
+ 1);
+ p += brace_len;
+ if (! valid) {
+ RExC_parse = p; /* going to die anyway; point
+ to exact spot of failure */
vFAIL(error_msg);
}
else
{
ender = result;
}
- p += brace_len;
if (PL_encoding && ender < 0x100) {
goto recode_encoding;
}
@@ -7995,7 +7998,6 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, U32 depth)
parseit:
while (RExC_parse < RExC_end && UCHARAT(RExC_parse) != ']') {
- char* error_msg;
charclassloop:
@@ -8104,15 +8106,18 @@ parseit:
case 'a': value = ASCII_TO_NATIVE('\007');break;
case 'o':
RExC_parse--; /* function expects to be pointed at the 'o' */
- if ((error_msg = grok_bslash_o(RExC_parse,
+ {
+ const char* error_msg;
+ bool valid = grok_bslash_o(RExC_parse,
&value,
&numlen,
- SIZE_ONLY))
- != NULL)
- {
- vFAIL(error_msg);
+ &error_msg,
+ SIZE_ONLY);
+ RExC_parse += numlen;
+ if (! valid) {
+ vFAIL(error_msg);
+ }
}
- RExC_parse += numlen;
if (PL_encoding && value < 0x100) {
goto recode_encoding;
}