Error in iteractive algorithm, continue statement, continue for and not global while

This commit is contained in:
Grégory Soutadé 2016-02-06 14:23:28 +01:00
parent 501875ae2b
commit 401a2e98af

View File

@ -12,12 +12,13 @@
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];
@ -38,7 +39,7 @@ static const uint8_t* ip_to_geo_rec(uint8_t* ip, unsigned level, const ip_level*
{ \
level++; \
root = cur_ip->childs; \
continue; \
goto start_loop; \
} \
else \
return &cur_ip->code; \
@ -105,7 +106,7 @@ int interactive(struct gengetopt_args_info* params)
}
}
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>");