From d19b383bb29f14811f399b5388c86d70a717fd1a Mon Sep 17 00:00:00 2001 From: phoenix Date: Sat, 19 Sep 2026 16:37:43 -0400 Subject: [PATCH] Code formatting --- src/klist.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/klist.c b/src/klist.c index 8e6753f..ebd09d6 100644 --- a/src/klist.c +++ b/src/klist.c @@ -44,13 +44,12 @@ int is_list_init(struct node **list) else return 0; } + int list_size(struct node **list) { int count = 0; struct node *tmp = *list; - struct node *in_tmp = NULL; - while (tmp != NULL || tmp->next != NULL) { in_tmp = tmp; tmp = tmp->next; @@ -81,6 +80,7 @@ void insert_at_begin(struct node **list, void *val, size_t val_size) tmp->next = *list; *list = tmp; } + void insert_at_end(struct node **list, void *val, size_t val_size) { struct node *tmp = (struct node*)malloc(sizeof(struct node)); @@ -102,6 +102,7 @@ void insert_at_end(struct node **list, void *val, size_t val_size) tmp->next->data = tmp_val; tmp->next->next = NULL; } + void free_list(struct node **list) { struct node *t = NULL; @@ -120,8 +121,8 @@ void free_list(struct node **list) return; } while (l->next != NULL); - } + void traverse(struct node *list, void (*print_val)(struct node*)) { if (list == NULL)