Browse Source

chartree optimizations. x86_32 bin

pull/21/head
bolvan 7 years ago
parent
commit
6b51e919a8
  1. BIN
      binaries/armhf/tpws
  2. BIN
      binaries/mips32r1-lsb/tpws
  3. BIN
      binaries/mips32r1-msb/tpws
  4. BIN
      binaries/x86/nfqws
  5. BIN
      binaries/x86/tpws
  6. BIN
      binaries/x86_64/tpws
  7. 24
      tpws/chartree.c
  8. 3
      tpws/tpws.c

BIN
binaries/armhf/tpws

Binary file not shown.

BIN
binaries/mips32r1-lsb/tpws

Binary file not shown.

BIN
binaries/mips32r1-msb/tpws

Binary file not shown.

BIN
binaries/x86/nfqws

Binary file not shown.

BIN
binaries/x86/tpws

Binary file not shown.

BIN
binaries/x86_64/tpws

Binary file not shown.

24
tpws/chartree.c

@ -2,14 +2,6 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
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) static cptr *CharTreeInit(char c)
{ {
cptr *p; cptr *p;
@ -19,11 +11,13 @@ static cptr *CharTreeInit(char c)
} }
void CharTreeDestroy(cptr *p) void CharTreeDestroy(cptr *p)
{ {
if (p) cptr *p2;
while (p)
{ {
CharTreeDestroy(p->leaf); CharTreeDestroy(p->leaf);
CharTreeDestroy(p->next); p2 = p;
free(p); p = p->next;
free(p2);
} }
} }
static cptr *CharTreeFindChar(cptr *p,char c) static cptr *CharTreeFindChar(cptr *p,char c)
@ -61,6 +55,14 @@ bool CharTreeCheckStr(cptr *p,const char *s)
if (!*s) return true; if (!*s) return true;
return CharTreeCheckStr(p->leaf,s+1); 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 CharTreeAddStrLower(cptr **pp,const char *s)
{ {
bool b; bool b;

3
tpws/tpws.c

@ -41,7 +41,8 @@ bool LoadHostList(cptr **hostlist, char *filename)
while (fgets(s, 256, F)) while (fgets(s, 256, F))
{ {
for (p = s + strlen(s) - 1; p >= s && (*p == '\r' || *p == '\n'); p--) *p = 0; 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); CharTreeDestroy(*hostlist);
*hostlist = NULL; *hostlist = NULL;

Loading…
Cancel
Save