diff --git a/dunst.c b/dunst.c index d5dc8ce..0d8149f 100644 --- a/dunst.c +++ b/dunst.c @@ -57,6 +57,7 @@ static int message_h; /* list functions */ msg_queue_t *append(msg_queue_t *queue, char *msg); msg_queue_t *pop(msg_queue_t *queue); +int list_len(msg_queue_t *list); /* misc funtions */ @@ -102,6 +103,18 @@ pop(msg_queue_t *queue) { return new_head; } +int list_len(msg_queue_t *list) { + int count = 0; + msg_queue_t *i; + if(list == NULL) { + return 0; + } + for(i = list; i != NULL; i = i->next) { + count++; + } + return count; +} + void drawmsg(const char *msg) { int width, x, y;