home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / hp / 9474 < prev    next >
Encoding:
Text File  |  1992-08-19  |  1.4 KB  |  54 lines

  1. Path: sparky!uunet!caen!uakari.primate.wisc.edu!tik.vtt.fi!tml
  2. From: tml@tik.vtt.fi (Tor Lillqvist)
  3. Newsgroups: comp.sys.hp
  4. Subject: Re: remque, insque source code?
  5. Message-ID: <TML.92Aug20092530@hemuli.tik.vtt.fi>
  6. Date: 20 Aug 92 09:25:30 GMT
  7. References: <2845@tivoli.UUCP>
  8. Sender: news@tik.vtt.fi (USENET)
  9. Organization: Technical Research Centre of Finland, Laboratory for Information
  10.     Processing (VTT/TIK)
  11. Lines: 40
  12. In-Reply-To: stuart@TIVOLI.COM's message of 19 Aug 92 21:39:56 GMT
  13.  
  14. In article <2845@tivoli.UUCP> stuart@TIVOLI.COM (Stuart Jarriel) writes:
  15.    Does anyone know of a public source for remque/insque?
  16.  
  17. Here you are: (from X11R5/mit/lib/Berk/Berklib.c)
  18.  
  19. #ifdef WANT_QUE
  20. struct qelem {
  21.     struct    qelem *q_forw;
  22.     struct    qelem *q_back;
  23.     char *q_data;
  24.     };
  25.  
  26. insque(elem, pred)
  27. register struct qelem *elem, *pred;
  28. {
  29.     register struct qelem *q;
  30.     /* Insert locking code here */
  31.     if ( elem->q_forw = q = (pred ? pred->q_forw : pred) )
  32.     q->q_back = elem;
  33.     if ( elem->q_back = pred )
  34.     pred->q_forw = elem;
  35.     /* Insert unlocking code here */
  36. }
  37.  
  38. remque(elem)
  39. register struct qelem *elem;
  40. {
  41.     register struct qelem *q;
  42.     if ( ! elem ) return;
  43.     /* Insert locking code here */
  44.  
  45.     if ( q = elem->q_back ) q->q_forw = elem->q_forw;
  46.     if ( q = elem->q_forw ) q->q_back = elem->q_back;
  47.  
  48.     /* insert unlocking code here */
  49. }
  50. #endif /* WANT_QUE */
  51. --
  52. Tor Lillqvist,
  53. working, but not speaking, for the Technical Research Centre of Finland
  54.