--- xinu/sys/newqueue.c 2018/04/24 17:39:02 1.1 +++ xinu/sys/newqueue.c 2018/04/24 17:39:29 1.1.1.2 @@ -8,19 +8,19 @@ * newqueue -- initialize a new list in the q structure *------------------------------------------------------------------------ */ -int newqueue() +int newqueue(hindex,tindex) + int *hindex,*tindex; /* addresses of integers to */ + /* contain head, tail indexes */ { - struct qent *hptr; /* address of new list head */ - struct qent *tptr; /* address of new list tail */ - int hindex, tindex; /* head and tail indexes */ + struct qent *hptr; + struct qent *tptr; - hptr = &q[ hindex=nextqueue++ ];/* nextqueue is global variable */ - tptr = &q[ tindex=nextqueue++ ];/* giving next used q pos. */ - hptr->qnext = tindex; + hptr = &q[(*hindex)=nextqueue++]; /* assign and rememeber queue */ + tptr = &q[(*tindex)=nextqueue++]; /* index values for head&tail */ + hptr->qnext = *tindex; hptr->qprev = EMPTY; - hptr->qkey = MINSHORT; tptr->qnext = EMPTY; - tptr->qprev = hindex; - tptr->qkey = MAXSHORT; - return(hindex); + hptr->qkey = MININT; + tptr->qkey = MAXINT; + tptr->qprev = *hindex; }