summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2006-09-27 20:37:11 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2006-09-27 20:37:11 (GMT)
commit3fe8faa0d5b71da69e9ca5fdb5c9ae58d1c58e29 (patch)
treeb3bebf4bc9b210c627d0bdf7a3367ae9e567015d /generic
parent8c38009f20bbb6eac54a8d9a6302cb32b695a1e2 (diff)
downloadtcl-3fe8faa0d5b71da69e9ca5fdb5c9ae58d1c58e29.zip
tcl-3fe8faa0d5b71da69e9ca5fdb5c9ae58d1c58e29.tar.gz
tcl-3fe8faa0d5b71da69e9ca5fdb5c9ae58d1c58e29.tar.bz2
* generic/regc_cvec.c (addmcce):
* generic/regcomp.c (compile): the static function addmcce does nothing when called with two NULL pointers; the only call is by compile with two NULL pointers (regcomp.c #includes regc_cvec.c). The whole thing is now ifdef'ed out with the macro REGEXP_ADDMCCE_UNUSED. This also silences coverity's #7.
Diffstat (limited to 'generic')
-rw-r--r--generic/regc_cvec.c9
-rw-r--r--generic/regcomp.c5
2 files changed, 14 insertions, 0 deletions
diff --git a/generic/regc_cvec.c b/generic/regc_cvec.c
index f4c6dd0..1e38476 100644
--- a/generic/regc_cvec.c
+++ b/generic/regc_cvec.c
@@ -111,10 +111,18 @@ addrange(
cv->nranges++;
}
+#ifdef REGEXP_ADDMCCE_UNUSED
+/*
+ * This static function is currently called from a single spot in regcomp.c,
+ * with two NULL pointers; in that case it does nothing, so that we define out
+ * both the call and the code.
+ */
+
/*
- addmcce - add an MCCE to a cvec
^ static VOID addmcce(struct cvec *, chr *, chr *);
*/
+
static void
addmcce(
struct cvec *cv, /* character vector */
@@ -142,6 +150,7 @@ addmcce(
assert(d == &cv->chrs[cv->chrspace - cv->nmccechrs]);
cv->nmccechrs += len + 1;
}
+#endif
/*
- haschr - does a cvec contain this chr?
diff --git a/generic/regcomp.c b/generic/regcomp.c
index c6c7342..fb159cb 100644
--- a/generic/regcomp.c
+++ b/generic/regcomp.c
@@ -171,7 +171,9 @@ static struct cvec *newcvec(int, int, int);
static struct cvec *clearcvec(struct cvec *);
static VOID addchr(struct cvec *, pchr);
static VOID addrange(struct cvec *, pchr, pchr);
+#ifdef REGEXP_ADDMCCE_UNUSED
static VOID addmcce(struct cvec *, chr *, chr *);
+#endif
static int haschr(struct cvec *, pchr);
static struct cvec *getcvec(struct vars *, int, int, int);
static VOID freecvec(struct cvec *);
@@ -364,7 +366,10 @@ compile(
CNOERR();
v->mcces = allmcces(v, v->mcces);
leaders(v, v->mcces);
+#ifdef REGEXP_ADDMCCE_UNUSED
+ /* Function does nothing with NULL pointers */
addmcce(v->mcces, (chr *)NULL, (chr *)NULL); /* dummy */
+#endif
}
CNOERR();