mirror of
https://github.com/cathugger/mkp224o.git
synced 2025-01-25 02:02:57 -03:00
some cleanups
This commit is contained in:
parent
f1f25ba2b6
commit
5e97518634
3 changed files with 10 additions and 10 deletions
|
@ -43,7 +43,7 @@ struct binfilter {
|
||||||
|
|
||||||
|
|
||||||
#ifdef BINFILTER
|
#ifdef BINFILTER
|
||||||
VEC_STRUCT(bfiltervec,struct binfilter) filters;
|
static VEC_STRUCT(bfiltervec,struct binfilter) filters;
|
||||||
#endif // BINFILTER
|
#endif // BINFILTER
|
||||||
|
|
||||||
#ifdef INTFILTER
|
#ifdef INTFILTER
|
||||||
|
@ -53,7 +53,7 @@ struct intfilter {
|
||||||
IFT m;
|
IFT m;
|
||||||
# endif
|
# endif
|
||||||
} ;
|
} ;
|
||||||
VEC_STRUCT(ifiltervec,struct intfilter) filters;
|
static VEC_STRUCT(ifiltervec,struct intfilter) filters;
|
||||||
# ifdef OMITMASK
|
# ifdef OMITMASK
|
||||||
IFT ifiltermask;
|
IFT ifiltermask;
|
||||||
# endif
|
# endif
|
||||||
|
@ -68,7 +68,7 @@ struct pcre2filter {
|
||||||
char *str;
|
char *str;
|
||||||
pcre2_code *re;
|
pcre2_code *re;
|
||||||
} ;
|
} ;
|
||||||
VEC_STRUCT(pfiltervec,struct pcre2filter) filters;
|
static VEC_STRUCT(pfiltervec,struct pcre2filter) filters;
|
||||||
|
|
||||||
#endif // PCRE2FILTER
|
#endif // PCRE2FILTER
|
||||||
|
|
||||||
|
|
12
main.c
12
main.c
|
@ -178,8 +178,8 @@ static inline void shiftpk(u8 *dst,const u8 *src,size_t sbits)
|
||||||
size_t i,sbytes = sbits / 8;
|
size_t i,sbytes = sbits / 8;
|
||||||
sbits %= 8;
|
sbits %= 8;
|
||||||
for (i = 0;i + sbytes < PUBLIC_LEN;++i) {
|
for (i = 0;i + sbytes < PUBLIC_LEN;++i) {
|
||||||
dst[i] = (src[i+sbytes] << sbits) |
|
dst[i] = (u8) ((src[i+sbytes] << sbits) |
|
||||||
(src[i+sbytes+1] >> (8 - sbits));
|
(src[i+sbytes+1] >> (8 - sbits)));
|
||||||
}
|
}
|
||||||
for(;i < PUBLIC_LEN;++i)
|
for(;i < PUBLIC_LEN;++i)
|
||||||
dst[i] = 0;
|
dst[i] = 0;
|
||||||
|
@ -395,7 +395,7 @@ end:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void printhelp(const char *progname)
|
static void printhelp(const char *progname)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Usage: %s filter [filter...] [options]\n"
|
"Usage: %s filter [filter...] [options]\n"
|
||||||
|
@ -432,7 +432,7 @@ void setworkdir(const char *wd)
|
||||||
fprintf(stderr, "unset workdir\n");
|
fprintf(stderr, "unset workdir\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int needslash = 0;
|
unsigned needslash = 0;
|
||||||
if (wd[l-1] != '/')
|
if (wd[l-1] != '/')
|
||||||
needslash = 1;
|
needslash = 1;
|
||||||
char *s = malloc(l + needslash + 1);
|
char *s = malloc(l + needslash + 1);
|
||||||
|
@ -683,7 +683,7 @@ int main(int argc,char **argv)
|
||||||
fprintf(stderr, "failed to get time\n");
|
fprintf(stderr, "failed to get time\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
istarttime = (1000000 * (u64)nowtime.tv_sec) + (nowtime.tv_nsec / 1000);
|
istarttime = (1000000 * (u64)nowtime.tv_sec) + ((u64)nowtime.tv_nsec / 1000);
|
||||||
#endif
|
#endif
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
memset(&ts,0,sizeof(ts));
|
memset(&ts,0,sizeof(ts));
|
||||||
|
@ -697,7 +697,7 @@ int main(int argc,char **argv)
|
||||||
|
|
||||||
#ifdef STATISTICS
|
#ifdef STATISTICS
|
||||||
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) + ((u64)nowtime.tv_nsec / 1000);
|
||||||
u64 sumcalc = 0,sumsuccess = 0,sumrestart = 0;
|
u64 sumcalc = 0,sumsuccess = 0,sumrestart = 0;
|
||||||
for (int i = 0;i < numthreads;++i) {
|
for (int i = 0;i < numthreads;++i) {
|
||||||
u32 newt,tdiff;
|
u32 newt,tdiff;
|
||||||
|
|
2
vec.h
2
vec.h
|
@ -20,7 +20,7 @@ do { \
|
||||||
|
|
||||||
void vec_addn(struct vec_basestruct *ctl,size_t sz,size_t n);
|
void vec_addn(struct vec_basestruct *ctl,size_t sz,size_t n);
|
||||||
#define VEC_ADDN(ctl,n) \
|
#define VEC_ADDN(ctl,n) \
|
||||||
vec_addn((struct vec_basestruct *)&(ctl),VEC_ELSIZE(ctl),(n))
|
vec_addn((struct vec_basestruct *)&(ctl),VEC_ELSIZE(ctl),(size_t)(n))
|
||||||
|
|
||||||
#define VEC_REMOVEN(ctl,n,m) \
|
#define VEC_REMOVEN(ctl,n,m) \
|
||||||
do { \
|
do { \
|
||||||
|
|
Loading…
Add table
Reference in a new issue