int main(int argc,char* argv[]) { if(argc<2) return 1; FILE* f=fopen("whitelist.wdb","rb"); init_whitelist(); printf("%d,",load_whitelist(f)); struct timeval tv0,tv01; gettimeofday(&tv0,NULL); build_whitelist(); gettimeofday(&tv01,NULL); show_time(tv0,tv01); fclose(f); FILE* f2=fopen(argv[1],"rb"); fseek(f2,0,SEEK_END); long p=ftell(f2); fseek(f2,0,SEEK_SET); char* x = malloc(p+1); if(fread(x,p,1,f2)!=1) return 2; x[p]=0; fclose(f2); struct timeval tv1,tv2,diff; gettimeofday(&tv1,NULL); int rc=whitelist_match(x,"test",0); gettimeofday(&tv2,NULL); show_time(tv1,tv2); printf("%d\n",rc); free(x); whitelist_done(); /* const char* real = "http://pics.ebaystatic.com/"; const char* display = "http://www.ebay.com/"; printf("%d\n",whitelist_match(real,display,0));*/ return 0; }
static int whitelist_check(const struct cl_engine* engine,struct url_check* urls,int hostOnly) { return whitelist_match(engine,urls->realLink.data,urls->displayLink.data,hostOnly); }