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