diff --git a/binaries/armhf/tpws b/binaries/armhf/tpws old mode 100755 new mode 100644 index b054a71..c3a748f Binary files a/binaries/armhf/tpws and b/binaries/armhf/tpws differ diff --git a/binaries/mips32r1-lsb/tpws b/binaries/mips32r1-lsb/tpws old mode 100755 new mode 100644 index 9a8cad2..568e340 Binary files a/binaries/mips32r1-lsb/tpws and b/binaries/mips32r1-lsb/tpws differ diff --git a/binaries/mips32r1-msb/tpws b/binaries/mips32r1-msb/tpws old mode 100755 new mode 100644 index 83940a0..9648b72 Binary files a/binaries/mips32r1-msb/tpws and b/binaries/mips32r1-msb/tpws differ diff --git a/binaries/x86/nfqws b/binaries/x86/nfqws new file mode 100644 index 0000000..c2ed780 Binary files /dev/null and b/binaries/x86/nfqws differ diff --git a/binaries/x86/tpws b/binaries/x86/tpws new file mode 100644 index 0000000..3547e15 Binary files /dev/null and b/binaries/x86/tpws differ diff --git a/binaries/x86_64/tpws b/binaries/x86_64/tpws old mode 100755 new mode 100644 index d7011fa..366b346 Binary files a/binaries/x86_64/tpws and b/binaries/x86_64/tpws differ diff --git a/tpws/chartree.c b/tpws/chartree.c index 8a44b8d..4668eb5 100644 --- a/tpws/chartree.c +++ b/tpws/chartree.c @@ -2,14 +2,6 @@ #include #include -static char *DupLower(const char *s) -{ - char *sp,*sl = strdup(s); - if (!sl) return false; - for(sp=sl;*sp;sp++) *sp=tolower(*sp); - return sl; -} - static cptr *CharTreeInit(char c) { cptr *p; @@ -19,11 +11,13 @@ static cptr *CharTreeInit(char c) } void CharTreeDestroy(cptr *p) { - if (p) + cptr *p2; + while (p) { CharTreeDestroy(p->leaf); - CharTreeDestroy(p->next); - free(p); + p2 = p; + p = p->next; + free(p2); } } static cptr *CharTreeFindChar(cptr *p,char c) @@ -61,6 +55,14 @@ bool CharTreeCheckStr(cptr *p,const char *s) if (!*s) return true; return CharTreeCheckStr(p->leaf,s+1); } + +static char *DupLower(const char *s) +{ + char *sp,*sl = strdup(s); + if (!sl) return false; + for(sp=sl;*sp;sp++) *sp=tolower(*sp); + return sl; +} bool CharTreeAddStrLower(cptr **pp,const char *s) { bool b; diff --git a/tpws/tpws.c b/tpws/tpws.c index f9f74b6..dda631d 100644 --- a/tpws/tpws.c +++ b/tpws/tpws.c @@ -41,7 +41,8 @@ bool LoadHostList(cptr **hostlist, char *filename) while (fgets(s, 256, F)) { for (p = s + strlen(s) - 1; p >= s && (*p == '\r' || *p == '\n'); p--) *p = 0; - if (!CharTreeAddStrLower(hostlist, s)) + for (p = s; *p; p++) *p=tolower(*p); + if (!CharTreeAddStr(hostlist, s)) { CharTreeDestroy(*hostlist); *hostlist = NULL;