Error in iteractive algorithm, continue statement, continue for and not global while
This commit is contained in:
parent
501875ae2b
commit
401a2e98af
|
@ -12,12 +12,13 @@
|
||||||
|
|
||||||
static const uint8_t* ip_to_geo_rec(uint8_t* ip, unsigned level, const ip_level* root)
|
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;
|
const ip_level* cur_ip;
|
||||||
unsigned cur_addr;
|
uint8_t cur_addr;
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
start_loop:
|
||||||
cur_ip = root;
|
cur_ip = root;
|
||||||
cur_addr = ip[level];
|
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++; \
|
level++; \
|
||||||
root = cur_ip->childs; \
|
root = cur_ip->childs; \
|
||||||
continue; \
|
goto start_loop; \
|
||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
return &cur_ip->code; \
|
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)
|
if (params->quiet_flag)
|
||||||
printf("%s\n", (cc)?(char*)get_country_code(cc):"<none>");
|
printf("%s\n", (cc)?(char*)get_country_code(cc):"<none>");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user