Skip to content

Commit

Permalink
fix size management of the result table during filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
houkhouk committed Apr 12, 2024
1 parent d03b7f3 commit aef69d9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions engine/core/src/routing_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ search_result_t *RTFilter_ID(search_result_t *result, uint16_t id)
if (result->result_table[entry_nbr]->id != id)
{
// if we find an other id, erase it from the research table
memcpy(&result->result_table[entry_nbr], &result->result_table[entry_nbr + 1], sizeof(routing_table_t *) * (result->result_nbr - entry_nbr));
memcpy(&result->result_table[entry_nbr], &result->result_table[entry_nbr + 1], sizeof(routing_table_t *) * (result->result_nbr - entry_nbr - 1));
result->result_nbr--;
}
else
Expand Down Expand Up @@ -1006,7 +1006,7 @@ search_result_t *RTFilter_Type(search_result_t *result, luos_type_t type)
if (result->result_table[entry_nbr]->type != type)
{
// if we find an other type, erase it from the research table
memcpy(&result->result_table[entry_nbr], &result->result_table[entry_nbr + 1], sizeof(routing_table_t *) * (result->result_nbr - entry_nbr));
memcpy(&result->result_table[entry_nbr], &result->result_table[entry_nbr + 1], sizeof(routing_table_t *) * (result->result_nbr - entry_nbr - 1));
result->result_nbr--;
}
else
Expand Down Expand Up @@ -1042,7 +1042,7 @@ search_result_t *RTFilter_Node(search_result_t *result, uint16_t node_id)
if (RoutingTB_NodeIDFromID(result->result_table[entry_nbr]->id) != node_id)
{
// if we find an other node_id, erase it from the research table
memcpy(&result->result_table[entry_nbr], &result->result_table[entry_nbr + 1], sizeof(routing_table_t *) * (result->result_nbr - entry_nbr));
memcpy(&result->result_table[entry_nbr], &result->result_table[entry_nbr + 1], sizeof(routing_table_t *) * (result->result_nbr - entry_nbr - 1));
result->result_nbr--;
}
else
Expand Down Expand Up @@ -1078,7 +1078,7 @@ search_result_t *RTFilter_Alias(search_result_t *result, char *alias)
if (strstr(result->result_table[entry_nbr]->alias, alias) == 0)
{
// if we find an other node_id, erase it from the research table
memcpy(&result->result_table[entry_nbr], &result->result_table[entry_nbr + 1], sizeof(routing_table_t *) * (result->result_nbr - entry_nbr));
memcpy(&result->result_table[entry_nbr], &result->result_table[entry_nbr + 1], sizeof(routing_table_t *) * (result->result_nbr - entry_nbr - 1));
result->result_nbr--;
}
else
Expand Down Expand Up @@ -1114,7 +1114,7 @@ search_result_t *RTFilter_Service(search_result_t *result, service_t *service)
if (result->result_table[entry_nbr]->id != service->id)
{
// if we find an other id, erase it from the research table
memcpy(&result->result_table[entry_nbr], &result->result_table[entry_nbr + 1], sizeof(routing_table_t *) * (result->result_nbr - entry_nbr));
memcpy(&result->result_table[entry_nbr], &result->result_table[entry_nbr + 1], sizeof(routing_table_t *) * (result->result_nbr - entry_nbr - 1));
result->result_nbr--;
}
else
Expand Down

0 comments on commit aef69d9

Please sign in to comment.