diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-06-02 15:01:39 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-06-02 15:01:39 (GMT) |
commit | 08e46d1fd595ff2b9cb385169d90601c8b37fbf4 (patch) | |
tree | 46958d9464a8e3b34aec00ff5484a485491e6dd8 /generic/regexec.c | |
parent | 878d157876e32cc69a1f17558c101a5560c7e9f9 (diff) | |
download | tcl-08e46d1fd595ff2b9cb385169d90601c8b37fbf4.zip tcl-08e46d1fd595ff2b9cb385169d90601c8b37fbf4.tar.gz tcl-08e46d1fd595ff2b9cb385169d90601c8b37fbf4.tar.bz2 |
More int -> size_t, in regexp handling (should of been part of TIP #537/494)
Diffstat (limited to 'generic/regexec.c')
-rw-r--r-- | generic/regexec.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/generic/regexec.c b/generic/regexec.c index fdbdef0..f9d25ce 100644 --- a/generic/regexec.c +++ b/generic/regexec.c @@ -57,11 +57,12 @@ struct sset { /* state set */ }; struct dfa { - int nssets; /* size of cache */ - int nssused; /* how many entries occupied yet */ - int nstates; /* number of states */ + size_t nssets; /* size of cache */ + size_t nssused; /* how many entries occupied yet */ + size_t nstates; /* number of states */ + size_t wordsper; /* length of state-set bitvectors */ int ncolors; /* length of outarc and inchain vectors */ - int wordsper; /* length of state-set bitvectors */ + int cptsmalloced; /* were the areas individually malloced? */ struct sset *ssets; /* state-set cache */ unsigned *statesarea; /* bitvector storage */ unsigned *work; /* pointer to work area within statesarea */ @@ -72,7 +73,6 @@ struct dfa { chr *lastpost; /* location of last cache-flushed success */ chr *lastnopr; /* location of last cache-flushed NOPROGRESS */ struct sset *search; /* replacement-search-pointer memory */ - int cptsmalloced; /* were the areas individually malloced? */ char *mallocarea; /* self, or malloced area, or NULL */ }; @@ -545,8 +545,8 @@ zapallsubs( size_t i; for (i = n-1; i > 0; i--) { - p[i].rm_so = -1; - p[i].rm_eo = -1; + p[i].rm_so = FREESTATE; + p[i].rm_eo = FREESTATE; } } @@ -560,11 +560,11 @@ zaptreesubs( struct subre *const t) { if (t->op == '(') { - int n = t->subno; + size_t n = t->subno; assert(n > 0); - if ((size_t) n < v->nmatch) { - v->pmatch[n].rm_so = -1; - v->pmatch[n].rm_eo = -1; + if (n < v->nmatch) { + v->pmatch[n].rm_so = FREESTATE; + v->pmatch[n].rm_eo = FREESTATE; } } @@ -882,7 +882,7 @@ cbrdissect( MDEBUG(("cbackref n%d %d{%d-%d}\n", t->id, n, min, max)); /* get the backreferenced string */ - if (v->pmatch[n].rm_so == TCL_INDEX_NONE) { + if (v->pmatch[n].rm_so == FREESTATE) { return REG_NOMATCH; } brstring = v->start + v->pmatch[n].rm_so; |