From 18263c857f150b630e8e99e884907742e3878c44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Sun, 22 May 2005 19:53:57 +0000 Subject: fixed a bug with priorities svn path=/trunk/externals/zexy/; revision=3067 --- src/fifop.c | 16 +++++++++------- src/lifop.c | 12 ++++++------ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/fifop.c b/src/fifop.c index a9dcb47..d8617ee 100644 --- a/src/fifop.c +++ b/src/fifop.c @@ -54,6 +54,7 @@ typedef struct _fifop static t_fifop_prioritylist*fifop_genprioritylist(t_fifop*x, t_float priority) { + int i; t_fifop_prioritylist*result=0, *dummy=0; if(x->fifo_list!=0) @@ -71,22 +72,23 @@ static t_fifop_prioritylist*fifop_genprioritylist(t_fifop*x, t_float priority) result=dummy; dummy=dummy->next; } - dummy=result; + dummy=result; /* dummy points to the FIFO-before the one we want to insert */ } /* create a new priority list */ result = (t_fifop_prioritylist*)getbytes(sizeof( t_fifop_prioritylist*)); result->priority=priority; result->fifo_start=0; + result->next=0; /* insert it into the list of priority lists */ - if(dummy!=0){ + if(dummy==0){ + /* insert at the beginning */ + result->next=x->fifo_list; + x->fifo_list=result; + } else { + /* post insert into the list of FIFOs */ result->next=dummy->next; dummy->next =result; - } else { - result->next=0; - } - if(x->fifo_list==0){ - x->fifo_list=result; } /* return the result */ diff --git a/src/lifop.c b/src/lifop.c index 4c1ccec..21289df 100644 --- a/src/lifop.c +++ b/src/lifop.c @@ -78,14 +78,14 @@ static t_lifop_prioritylist*lifop_genprioritylist(t_lifop*x, t_float priority) result->lifo_start=0; /* insert it into the list of priority lists */ - if(dummy!=0){ + if(dummy==0){ + /* insert at the beginning */ + result->next=x->lifo_list; + x->lifo_list=result; + } else { + /* post insert into the list of LIFOs */ result->next=dummy->next; dummy->next =result; - } else { - result->next=0; - } - if(x->lifo_list==0){ - x->lifo_list=result; } /* return the result */ -- cgit v1.2.1