list_len(...)

This commit is contained in:
Sascha Kruse 2011-09-12 18:16:41 +02:00
parent 78ba452469
commit 8979ccb48b

13
dunst.c
View File

@ -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;