From: Nicholas Clark Date: Tue, 18 Apr 2006 10:54:15 +0000 (+0000) Subject: Coverity insists that if we deference a pointer without checking, and X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ecaa9b9cab16865b1a89bd4b15cd989b1eb47178;p=p5sagit%2Fp5-mst-13.2.git 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 --- diff --git a/regcomp.c b/regcomp.c index a820e5a..d2e99a1 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! */