summaryrefslogtreecommitdiffhomepage
path: root/src/cregex.c
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-11-21 17:59:06 +0100
committerTyge Løvset <[email protected]>2022-11-21 17:59:06 +0100
commitdcaf91987cfacd6a6ed66532e5a2a4200c46651b (patch)
tree009953e3aeb97708a3dc8ddae6072ac411a81637 /src/cregex.c
parenta084d28b651b988b244b1c6be1d4714e6a4b15c9 (diff)
downloadSTC-modified-dcaf91987cfacd6a6ed66532e5a2a4200c46651b.tar.gz
STC-modified-dcaf91987cfacd6a6ed66532e5a2a4200c46651b.zip
Updated shootout_hashmap.cpp, and fixed some unsigned warnings.
Diffstat (limited to 'src/cregex.c')
-rw-r--r--src/cregex.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/cregex.c b/src/cregex.c
index 6eadd257..413e1620 100644
--- a/src/cregex.c
+++ b/src/cregex.c
@@ -79,7 +79,7 @@ typedef struct _Reprog
{
_Reinst *startinst; /* start pc */
_Reflags flags;
- int nsubids;
+ unsigned nsubids;
_Reclass cclass[_NCLASS]; /* .data */
_Reinst firstinst[]; /* .text : originally 5 elements? */
} _Reprog;
@@ -224,15 +224,13 @@ utfruneicase(const char *s, _Rune c)
* save a new match in mp
*/
static void
-_renewmatch(_Resub *mp, unsigned ms, _Resublist *sp, int nsubids)
+_renewmatch(_Resub *mp, unsigned ms, _Resublist *sp, unsigned nsubids)
{
- int i;
-
if (mp==NULL || ms==0)
return;
if (mp[0].str == NULL || sp->m[0].str < mp[0].str ||
(sp->m[0].str == mp[0].str && sp->m[0].size > mp[0].size)) {
- for (i=0; i<ms && i<=nsubids; i++)
+ for (unsigned i=0; i<ms && i<=nsubids; i++)
mp[i] = sp->m[i];
}
}
@@ -937,9 +935,9 @@ _regexec1(const _Reprog *progp, /* program to run */
_Relist *tl, *nl; /* This list, next list */
_Relist *tle, *nle; /* Ends of this and next list */
const char *s, *p;
- int i, n, checkstart;
_Rune r, *rp, *ep;
- int match = 0;
+ int n, checkstart, match = 0;
+ unsigned i;
bool icase = progp->flags.caseless;
checkstart = j->starttype;
@@ -1157,7 +1155,7 @@ _build_subst(const char* replace, unsigned nmatch, const csview match[],
while (*replace != '\0') {
if (*replace == '$') {
const int arg = *++replace;
- int g;
+ unsigned g;
switch (arg) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':