summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-04-18 10:54:15 +0000
committerNicholas Clark <nick@ccl4.org>2006-04-18 10:54:15 +0000
commitecaa9b9cab16865b1a89bd4b15cd989b1eb47178 (patch)
treebf39f62c407c2b9e49b559f132a4e738cd45695c /regcomp.c
parent903fe02ab005d9a6f5d2870ed93bddff5a74bffb (diff)
downloadperl-ecaa9b9cab16865b1a89bd4b15cd989b1eb47178.tar.gz
Coverity insists that if we deference a pointer without checking, and
subsequently check that same pointer before deferencing it, something in our code or our logic is bogus. So assert() that it's safe the first time and remove the second check. p4raw-id: //depot/perl@27882
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/regcomp.c b/regcomp.c
index a820e5af2f..d2e99a125d 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -2030,15 +2030,17 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap,
UV uc = *((U8*)STRING(scan));
/* Search for fixed substrings supports EXACT only. */
- if (flags & SCF_DO_SUBSTR)
+ if (flags & SCF_DO_SUBSTR) {
+ assert(data);
scan_commit(pRExC_state, data);
+ }
if (UTF) {
const U8 * const s = (U8 *)STRING(scan);
l = utf8_length(s, s + l);
uc = utf8_to_uvchr(s, NULL);
}
min += l;
- if (data && (flags & SCF_DO_SUBSTR))
+ if (flags & SCF_DO_SUBSTR)
data->pos_min += l;
if (flags & SCF_DO_STCLASS_AND) {
/* Check whether it is compatible with what we know already! */