linked-list: Remove barely used has_more() method
This required some refactoring when handling encrypted payloads. Also changed log messages so that "encrypted payload" is logged instead of "encryption payload" (even if we internally still call it that) as that's the name used in RFC 5996.
This commit is contained in:
@@ -168,16 +168,6 @@ METHOD(linked_list_t, reset_enumerator, void,
|
||||
enumerator->finished = FALSE;
|
||||
}
|
||||
|
||||
METHOD(linked_list_t, has_more, bool,
|
||||
private_linked_list_t *this, private_enumerator_t *enumerator)
|
||||
{
|
||||
if (enumerator->current)
|
||||
{
|
||||
return enumerator->current->next != NULL;
|
||||
}
|
||||
return !enumerator->finished && this->first != NULL;
|
||||
}
|
||||
|
||||
METHOD(linked_list_t, get_count, int,
|
||||
private_linked_list_t *this)
|
||||
{
|
||||
@@ -500,7 +490,6 @@ linked_list_t *linked_list_create()
|
||||
.get_count = _get_count,
|
||||
.create_enumerator = _create_enumerator,
|
||||
.reset_enumerator = (void*)_reset_enumerator,
|
||||
.has_more = (void*)_has_more,
|
||||
.get_first = _get_first,
|
||||
.get_last = _get_last,
|
||||
.find_first = (void*)_find_first,
|
||||
|
||||
@@ -77,15 +77,6 @@ struct linked_list_t {
|
||||
*/
|
||||
void (*reset_enumerator)(linked_list_t *this, enumerator_t *enumerator);
|
||||
|
||||
/**
|
||||
* Checks if there are more elements following after the enumerator's
|
||||
* current position.
|
||||
*
|
||||
* @param enumerator enumerator to check
|
||||
* @return TRUE if more elements follow after the current item
|
||||
*/
|
||||
bool (*has_more)(linked_list_t *this, enumerator_t *enumerator);
|
||||
|
||||
/**
|
||||
* Inserts a new item at the beginning of the list.
|
||||
*
|
||||
|
||||
@@ -97,50 +97,6 @@ START_TEST(test_reset_enumerator)
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(test_has_more_empty)
|
||||
{
|
||||
enumerator_t *enumerator;
|
||||
intptr_t x;
|
||||
|
||||
list->destroy(list);
|
||||
list = linked_list_create();
|
||||
enumerator = list->create_enumerator(list);
|
||||
ck_assert(!list->has_more(list, enumerator));
|
||||
ck_assert(!enumerator->enumerate(enumerator, &x));
|
||||
ck_assert(!list->has_more(list, enumerator));
|
||||
enumerator->destroy(enumerator);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(test_has_more)
|
||||
{
|
||||
enumerator_t *enumerator;
|
||||
intptr_t x;
|
||||
int round;
|
||||
|
||||
round = 1;
|
||||
enumerator = list->create_enumerator(list);
|
||||
while (enumerator->enumerate(enumerator, &x))
|
||||
{
|
||||
ck_assert_int_eq(round, x);
|
||||
round++;
|
||||
if (x == 2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
ck_assert(list->has_more(list, enumerator));
|
||||
while (enumerator->enumerate(enumerator, &x))
|
||||
{
|
||||
ck_assert_int_eq(round, x);
|
||||
round++;
|
||||
}
|
||||
ck_assert(!list->has_more(list, enumerator));
|
||||
ck_assert_int_eq(round, 6);
|
||||
enumerator->destroy(enumerator);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
/*******************************************************************************
|
||||
* insert before
|
||||
*/
|
||||
@@ -202,7 +158,6 @@ START_TEST(test_insert_before_ends)
|
||||
ck_assert_int_eq(list->get_count(list), 7);
|
||||
ck_assert(list->get_last(list, (void*)&x) == SUCCESS);
|
||||
ck_assert_int_eq(x, 6);
|
||||
ck_assert(!list->has_more(list, enumerator));
|
||||
ck_assert(!enumerator->enumerate(enumerator, &x));
|
||||
enumerator->destroy(enumerator);
|
||||
}
|
||||
@@ -222,10 +177,9 @@ START_TEST(test_insert_before_empty)
|
||||
ck_assert_int_eq(x, 1);
|
||||
ck_assert(list->get_last(list, (void*)&x) == SUCCESS);
|
||||
ck_assert_int_eq(x, 1);
|
||||
ck_assert(list->has_more(list, enumerator));
|
||||
ck_assert(enumerator->enumerate(enumerator, &x));
|
||||
ck_assert_int_eq(x, 1);
|
||||
ck_assert(!list->has_more(list, enumerator));
|
||||
ck_assert(!enumerator->enumerate(enumerator, NULL));
|
||||
enumerator->destroy(enumerator);
|
||||
}
|
||||
END_TEST
|
||||
@@ -382,8 +336,6 @@ Suite *linked_list_enumerator_suite_create()
|
||||
tcase_add_test(tc, test_enumerate);
|
||||
tcase_add_test(tc, test_enumerate_null);
|
||||
tcase_add_test(tc, test_reset_enumerator);
|
||||
tcase_add_test(tc, test_has_more_empty);
|
||||
tcase_add_test(tc, test_has_more);
|
||||
suite_add_tcase(s, tc);
|
||||
|
||||
tc = tcase_create("insert_before()");
|
||||
|
||||
Reference in New Issue
Block a user