diff options
author | Nicholas Clark <nick@ccl4.org> | 2006-04-18 10:54:15 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2006-04-18 10:54:15 +0000 |
commit | ecaa9b9cab16865b1a89bd4b15cd989b1eb47178 (patch) | |
tree | bf39f62c407c2b9e49b559f132a4e738cd45695c /regcomp.c | |
parent | 903fe02ab005d9a6f5d2870ed93bddff5a74bffb (diff) | |
download | perl-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.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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! */ |