File: cque.h

package info (click to toggle)
nyquist 3.24%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 58,156 kB
  • sloc: ansic: 74,757; lisp: 18,169; java: 10,942; cpp: 6,688; sh: 175; xml: 58; makefile: 40; python: 15
file content (25 lines) | stat: -rw-r--r-- 531 bytes parent folder | download | duplicates (21)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* 
 * cque.h
 * macros for free lists.
 */

typedef struct cque {
    struct cque	*qnext;
} CQUE;

#define	Qinit(q1)	{ (q1) = 0; }

/* q1 points to a stack CQUE*, new is an element to insert */
#define Qenter(q1,new)  {   \
    ((CQUE *)(new))->qnext = ((CQUE *)(q1)); \
    q1 = ((CQUE *)(new)); }


/* q1 points to a list of CQUE*: remove elt and assign to new */
/* NOTE: q1 must be non-empty */
#define Qget(q1,newtype,new) {  \
    (new) = (newtype)(q1);  \
    q1 = ((CQUE *)(q1))->qnext; }


#define	Qempty(q1)	((q1) == 0)