Commit 088c755a authored by Pekka Pessi's avatar Pekka Pessi
Browse files

su_taglist.c: fixed tl_find_last(), added tests for it.

darcs-hash:20061004142848-65a35-311161ed444fdf03a73bb2d38aa06552fcffa599.gz
parent a04ca310
......@@ -345,7 +345,7 @@ tagi_t *tl_find_last(tagi_t const lst[], tag_type_t tt)
{
tagi_t const *last, *next;
for (next = last = t_find(tt, lst); next; next = t_find(tt, last))
for (next = last = t_find(tt, lst); next; next = t_find(tt, t_next(last)))
last = next;
return (tagi_t *)last;
......
......@@ -511,7 +511,7 @@ static int test_tagargs(void)
/* Test tl_tgets() and tl_gets() */
static int test_gets(void)
{
tagi_t *lst;
tagi_t *lst, *t;
char const *a = "B", *b = "A";
int i = 1, j = 0, k = 0, p = -1;
......@@ -530,6 +530,9 @@ static int test_gets(void)
TEST_1(lst);
TEST_1(t = tl_find(lst, tag_i)); TEST(t->t_value, 2);
TEST_1(t = tl_find_last(lst, tag_i)); TEST(t->t_value, 1);
TEST(tl_gets(lst,
TAG_A_REF(a),
TAG_B_REF(b),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment