fix -N for regex filters, fix some warnings
This commit is contained in:
parent
5df37bb545
commit
f1f25ba2b6
@ -98,7 +98,7 @@ static int parsecpuinfo()
|
||||
if (strcasecmp(buf,"processor") == 0 && v) {
|
||||
char *endp = 0;
|
||||
long n = strtol(v,&endp,10);
|
||||
if (endp && endp > v && n >= 0 && n < sizeof(cpubitmap) * 8)
|
||||
if (endp && endp > v && n >= 0 && (size_t)n < sizeof(cpubitmap) * 8)
|
||||
cpubitmap[n / 8] |= 1 << (n % 8);
|
||||
}
|
||||
}
|
||||
|
11
filters.h
11
filters.h
@ -310,10 +310,9 @@ static void filter_sort(void)
|
||||
#endif // BINFILTER
|
||||
|
||||
#ifdef PCRE2FILTER
|
||||
static size_t filter_len(size_t i)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define filter_len(i) ((pcre2ovector[1] - pcre2ovector[0]) * 5)
|
||||
|
||||
#endif // PCRE2FILTER
|
||||
|
||||
static void filters_add(const char *filter)
|
||||
@ -585,7 +584,8 @@ do { \
|
||||
|
||||
#define PREFILTER \
|
||||
char pkconvbuf[BASE32_TO_LEN(PUBLIC_LEN) + 1]; \
|
||||
pcre2_match_data *pcre2md = pcre2_match_data_create(128,0);
|
||||
pcre2_match_data *pcre2md = pcre2_match_data_create(128,0); \
|
||||
PCRE2_SIZE *pcre2ovector = 0;
|
||||
|
||||
#define POSTFILTER \
|
||||
pcre2_match_data_free(pcre2md);
|
||||
@ -598,6 +598,7 @@ do { \
|
||||
int rc = pcre2_match(VEC_BUF(filters,it).re,(PCRE2_SPTR8)pkconvbuf,BASE32_TO_LEN(PUBLIC_LEN),0, \
|
||||
PCRE2_NO_UTF_CHECK,pcre2md,0); \
|
||||
if (unlikely(rc >= 0)) { \
|
||||
pcre2ovector = pcre2_get_ovector_pointer(pcre2md); \
|
||||
code; \
|
||||
break; \
|
||||
} \
|
||||
|
6
main.c
6
main.c
@ -699,7 +699,7 @@ int main(int argc,char **argv)
|
||||
clock_gettime(CLOCK_MONOTONIC,&nowtime);
|
||||
inowtime = (1000000 * (u64)nowtime.tv_sec) + (nowtime.tv_nsec / 1000);
|
||||
u64 sumcalc = 0,sumsuccess = 0,sumrestart = 0;
|
||||
for (size_t i = 0;i < numthreads;++i) {
|
||||
for (int i = 0;i < numthreads;++i) {
|
||||
u32 newt,tdiff;
|
||||
// numcalc
|
||||
newt = VEC_BUF(stats,i).numcalc.v;
|
||||
@ -736,7 +736,7 @@ int main(int argc,char **argv)
|
||||
(inowtime - istarttime + elapsedoffset) / 1000000.0);
|
||||
|
||||
if (realtimestats) {
|
||||
for (size_t i = 0;i < numthreads;++i) {
|
||||
for (int i = 0;i < numthreads;++i) {
|
||||
VEC_BUF(tstats,i).numcalc = 0;
|
||||
VEC_BUF(tstats,i).numsuccess = 0;
|
||||
VEC_BUF(tstats,i).numrestart = 0;
|
||||
@ -746,7 +746,7 @@ int main(int argc,char **argv)
|
||||
}
|
||||
}
|
||||
if (sumcalc > U64_MAX / 2) {
|
||||
for (size_t i = 0;i < numthreads;++i) {
|
||||
for (int i = 0;i < numthreads;++i) {
|
||||
VEC_BUF(tstats,i).numcalc /= 2;
|
||||
VEC_BUF(tstats,i).numsuccess /= 2;
|
||||
VEC_BUF(tstats,i).numrestart /= 2;
|
||||
|
Loading…
Reference in New Issue
Block a user