IP to Geo

IP to Geo Commit Details

Date:2016-02-06 14:23:28 (4 years 5 months ago)
Author:Grégory Soutadé
Branch:master
Commit:401a2e98af356f2a0e07db6caae987a49ae1270c
Parents: 501875ae2bb5721ab1fb7386b59734b6f3a533ec
Message:Error in iteractive algorithm, continue statement, continue for and not global while

Changes:
Msrc/ip_to_geo.c (3 diffs)

File differences

src/ip_to_geo.c
1212
1313
1414
15
15
1616
17
17
1818
1919
2020
21
2122
2223
2324
......
3839
3940
4041
41
42
4243
4344
4445
......
105106
106107
107108
108
109
109110
110111
111112
static const uint8_t* ip_to_geo_rec(uint8_t* ip, unsigned level, const ip_level* root)
{
unsigned cur_average;
uint8_t cur_average;
const ip_level* cur_ip;
unsigned cur_addr;
uint8_t cur_addr;
while (1)
{
start_loop:
cur_ip = root;
cur_addr = ip[level];
{ \
level++; \
root = cur_ip->childs; \
continue; \
goto start_loop; \
} \
else \
return &cur_ip->code; \
}
}
cc = ip_to_geo((uint8_t*)&ret, ip_size);
cc = ip_to_geo(ip, ip_size);
if (params->quiet_flag)
printf("%s\n", (cc)?(char*)get_country_code(cc):"<none>");

Archive Download the corresponding diff file

Branches

Tags