34 lines
803 B
C
34 lines
803 B
C
#include <akstdlib.h>
|
|
|
|
akerr_ErrorContext AKERR_NOIGNORE *myiter(aksl_ListNode *node, void *data)
|
|
{
|
|
PREPARE_ERROR(e);
|
|
int count;
|
|
FAIL_ZERO_RETURN(e, node, AKERR_NULLPOINTER, "node");
|
|
FAIL_ZERO_RETURN(e, node->data, AKERR_NULLPOINTER, "node->data");
|
|
// This function doesn't use *data so we don't check it
|
|
|
|
PASS(e, aksl_fprintf(&count, stderr, "Visiting node : %s", node->data));
|
|
SUCCEED_RETURN(e);
|
|
}
|
|
|
|
int main(void)
|
|
{
|
|
PREPARE_ERROR(e);
|
|
aksl_ListNode mylist;
|
|
char *node1str = "Node 1";
|
|
aksl_ListNode node1;
|
|
char *node2str = "Node 2";
|
|
aksl_ListNode node2;
|
|
|
|
node1->data = (void *)&node1str;
|
|
PASS(e, aksl_list_push(&mylist, &node1));
|
|
|
|
node2->data = (void *)&node2str;
|
|
PASS(e, aksl_list_push(&mylist, &node2));
|
|
|
|
PASS(e, aksl_list_iterate(&mylist, &myiter, NULL));
|
|
|
|
SUCCEED_RETURN(e);
|
|
}
|