Optimize the ip2long function with trim logic applied
This commit is contained in:
parent
835d9c1b90
commit
d796a76400
|
|
@ -396,6 +396,11 @@ IP2R_API uint_t ip2long(const char *ip)
|
|||
uint_t ipval = 0;
|
||||
|
||||
while ( *cs != '\0' ) {
|
||||
if ( *cs == ' ' ) {
|
||||
cs++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( *cs == '.' ) {
|
||||
//single part length limit
|
||||
if ( i > 3 ) {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ int main( int argc, char **argv )
|
|||
datablock_entry datablock;
|
||||
char *dbFile = NULL, *algorithm = NULL;
|
||||
char line[256];
|
||||
uint_t (*func_ptr)(ip2region_t, char *, datablock_t);
|
||||
uint_t (*func_ptr)(ip2region_t, const char *, datablock_t);
|
||||
double s_time, c_time;
|
||||
memset(&datablock, 0x00, sizeof(datablock_entry));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue