From 4c398c3c1b2ecf6b8b0adf385894e3225a95da97 Mon Sep 17 00:00:00 2001 From: Jakob Olsson <jakobols@kth.se> Date: Wed, 30 May 2018 09:55:00 +0200 Subject: [PATCH] add print_list --- dfs.c | 12 ++++++++++++ dfs.h | 1 + 2 files changed, 13 insertions(+) diff --git a/dfs.c b/dfs.c index a00a695..2a4064f 100644 --- a/dfs.c +++ b/dfs.c @@ -60,4 +60,16 @@ void clear_list(struct list_head *visited) list_del(&n->list); free(n); } +} + +void print_list_dfs(struct list_head *collection_of_nodes_and_stuff) +{ + struct node *n; + + if (list_empty(collection_of_nodes_and_stuff)) + return; + + list_for_each_entry(n, collection_of_nodes_and_stuff, list) { + printf("path: %s\n", n->path); + } } \ No newline at end of file diff --git a/dfs.h b/dfs.h index f773fc2..f6d72c7 100644 --- a/dfs.h +++ b/dfs.h @@ -13,4 +13,5 @@ struct node *stack_dequeue(struct list_head *stack); void add_visited(struct node *n, struct list_head *visited); bool is_visited(char *path, struct list_head *visited); void clear_list(struct list_head *visited); +void print_list_dfs(struct list_head *collection_of_nodes_and_stuff); #endif \ No newline at end of file -- GitLab