LingYun Studio embeded system framwork software, such as thirdparty build shell and lingyun library
guowenxue
2024-09-25 89a20baa7f1071a0628d9765d4698fcdfd967486
update list.c
1 files modified
5 ■■■■■ changed files
booster/testcase/list.c 5 ●●●●● patch | view | raw | blame | history
booster/testcase/list.c
@@ -32,6 +32,7 @@
    INIT_LIST_HEAD(&head);
    /* Create the link list */
    printf("Create link list:\n");
    for(i=0; i<10; i++)
    {
        node = malloc(sizeof(*node));
@@ -40,16 +41,16 @@
        printf("List add an node data : %p->%d\n", node, node->data);
        list_add_tail(&node->list, &head);
    }
    printf("\n");
    /* Use list_for_each_entry to travel list, we can not remove the node in it */
    printf("\nTraversing the list:\n");
    list_for_each_entry(node, &head, list)
    {
        printf("List travel node data : %p->%d\n", node, node->data);
    }
    printf("\n");
    /* Use list_for_each_entry_safe to destroy the list */
    printf("\nDestroy link list:\r\n");
    list_for_each_entry_safe(node, tmp, &head, list)
    {
        printf("List remove node data : %p->%d\n", node, node->data);