chartree optimizations. x86_32 bin

This commit is contained in:
bolvan 2018-07-21 09:16:33 +03:00
parent 04bfec0e67
commit 6b51e919a8
8 changed files with 15 additions and 12 deletions

BIN
binaries/armhf/tpws Executable file → Normal file

Binary file not shown.

BIN
binaries/mips32r1-lsb/tpws Executable file → Normal file

Binary file not shown.

BIN
binaries/mips32r1-msb/tpws Executable file → Normal file

Binary file not shown.

BIN
binaries/x86/nfqws Normal file

Binary file not shown.

BIN
binaries/x86/tpws Normal file

Binary file not shown.

BIN
binaries/x86_64/tpws Executable file → Normal file

Binary file not shown.

View File

@ -2,14 +2,6 @@
#include <string.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)
{
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;

View File

@ -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;