vector: fix vector sorter functions everywhere #234

This commit is contained in:
Kaian 2018-02-28 21:29:26 +01:00
parent f9b8334f04
commit 3d5c047843
5 changed files with 4 additions and 21 deletions

View File

@ -1059,12 +1059,6 @@ capture_packet_time_sorter(vector_t *vector, void *item)
// TODO Implement multiframe packets
curts = packet_time(item);
prevts = packet_time(vector_last(vector));
// Check if the item is already sorted
if (timeval_is_older(curts, prevts)) {
return;
}
for (i = count - 2 ; i >= 0; i--) {
// Get previous packet

View File

@ -1500,12 +1500,6 @@ call_flow_arrow_sorter(vector_t *vector, void *item)
return;
curts = call_flow_arrow_time(item);
prevts = call_flow_arrow_time(vector_item(vector, vector_count(vector) - 2));
// Check if the item is already sorted
if (timeval_is_older(curts, prevts)) {
return;
}
for (i = count - 2 ; i >= 0; i--) {
// Get previous arrow

View File

@ -313,7 +313,6 @@ call_group_msg_sorter(vector_t *vector, void *item)
// Current and last packet times
curts = msg_get_time(item);
prevts = msg_get_time(vector_last(vector));
for (i = count - 2 ; i >= 0; i--) {
// Get previous packet
@ -324,4 +323,7 @@ call_group_msg_sorter(vector_t *vector, void *item)
return;
}
}
// Put this item at the begining of the vector
vector_insert(vector, item, 0);
}

View File

@ -933,13 +933,6 @@ sip_list_sorter(vector_t *vector, void *item)
if (vector_count(vector) == 1)
return;
prev = vector_item(vector, vector_count(vector) - 2);
// Check if the item is already sorted
if (call_attr_compare(cur, prev, calls.sort.by) == 0) {
return;
}
for (i = count - 2 ; i >= 0; i--) {
// Get previous item
prev = vector_item(vector, i);

View File

@ -192,7 +192,7 @@ vector_insert(vector_t *vector, void *item, int pos)
if (!item)
return vector->count;
if (pos < 0 || pos > vector->count)
if (pos < 0 || pos > vector->count - 2)
return vector->count;
// If position is already filled with that item, we're done