Annotation of 43BSDReno/contrib/isode-beta/rosy/rydsblock.c, revision 1.1

1.1     ! root        1: /* rydsblock.c - manage dispatch blocks */
        !             2: 
        !             3: #ifndef        lint
        !             4: static char *rcsid = "$Header: /f/osi/rosy/RCS/rydsblock.c,v 6.0 89/03/18 23:42:48 mrose Rel $";
        !             5: #endif
        !             6: 
        !             7: /* 
        !             8:  * $Header: /f/osi/rosy/RCS/rydsblock.c,v 6.0 89/03/18 23:42:48 mrose Rel $
        !             9:  *
        !            10:  *
        !            11:  * $Log:       rydsblock.c,v $
        !            12:  * Revision 6.0  89/03/18  23:42:48  mrose
        !            13:  * Release 5.0
        !            14:  * 
        !            15:  */
        !            16: 
        !            17: /*
        !            18:  *                               NOTICE
        !            19:  *
        !            20:  *    Acquisition, use, and distribution of this module and related
        !            21:  *    materials are subject to the restrictions of a license agreement.
        !            22:  *    Consult the Preface in the User's Manual for the full terms of
        !            23:  *    this agreement.
        !            24:  *
        !            25:  */
        !            26: 
        !            27: 
        !            28: /* LINTLIBRARY */
        !            29: 
        !            30: #include <stdio.h>
        !            31: #include "rosy.h"
        !            32: 
        !            33: /*    DATA */
        !            34: 
        !            35: static int  once_only = 0;
        !            36: static struct dspblk dspque;
        !            37: static struct dspblk *DSHead = &dspque;
        !            38: 
        !            39: /*    DISPATCH BLOCKS */
        !            40: 
        !            41: struct dspblk  *newdsblk (sd, ryo)
        !            42: int    sd;
        !            43: struct RyOperation *ryo;
        !            44: {
        !            45:     register struct dspblk *dsb;
        !            46: 
        !            47:     dsb = (struct dspblk   *) calloc (1, sizeof *dsb);
        !            48:     if (dsb == NULL)
        !            49:        return NULL;
        !            50: 
        !            51:     dsb -> dsb_fd = sd;
        !            52:     dsb -> dsb_ryo = ryo;
        !            53: 
        !            54:     if (once_only == 0) {
        !            55:        DSHead -> dsb_forw = DSHead -> dsb_back = DSHead;
        !            56:        once_only++;
        !            57:     }
        !            58: 
        !            59:     insque (dsb, DSHead -> dsb_back);
        !            60: 
        !            61:     return dsb;
        !            62: }
        !            63: 
        !            64: /*  */
        !            65: 
        !            66: freedsblk (dsb)
        !            67: register struct dspblk *dsb;
        !            68: {
        !            69:     if (dsb == NULL)
        !            70:        return;
        !            71: 
        !            72:     remque (dsb);
        !            73: 
        !            74:     free ((char *) dsb);
        !            75: }
        !            76: 
        !            77: /*  */
        !            78: 
        !            79: struct dspblk   *finddsblk (sd, op)
        !            80: register int   sd,
        !            81:                op;
        !            82: {
        !            83:     register struct dspblk *dsb;
        !            84: 
        !            85:     if (once_only == 0)
        !            86:        return NULL;
        !            87: 
        !            88:     for (dsb = DSHead -> dsb_forw; dsb != DSHead; dsb = dsb -> dsb_forw)
        !            89:        if (dsb -> dsb_fd == sd && dsb -> dsb_ryo -> ryo_op == op)
        !            90:            return dsb;
        !            91: 
        !            92:     return NULL;
        !            93: }
        !            94: 
        !            95: /*  */
        !            96: 
        !            97: losedsblk (sd)
        !            98: register int   sd;
        !            99: {
        !           100:     register struct dspblk *dsb,
        !           101:                            *ds2;
        !           102: 
        !           103:     if (once_only == 0)
        !           104:        return;
        !           105: 
        !           106:     for (dsb = DSHead -> dsb_forw; dsb != DSHead; dsb = ds2) {
        !           107:        ds2 = dsb -> dsb_forw;
        !           108: 
        !           109:        if (dsb -> dsb_fd == sd)
        !           110:            freedsblk (dsb);
        !           111:     }
        !           112: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.