Annotation of 43BSD/ucb/gprof/printlist.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1983 Regents of the University of California.
        !             3:  * All rights reserved.  The Berkeley software License Agreement
        !             4:  * specifies the terms and conditions for redistribution.
        !             5:  */
        !             6: 
        !             7: #ifndef lint
        !             8: static char sccsid[] = "@(#)printlist.c        5.1 (Berkeley) 6/4/85";
        !             9: #endif not lint
        !            10: 
        !            11: #include "gprof.h"
        !            12: 
        !            13:     /*
        !            14:      * these are the lists of names:
        !            15:      * there is the list head and then the listname
        !            16:      * is a pointer to the list head
        !            17:      * (for ease of passing to stringlist functions).
        !            18:      */
        !            19: struct stringlist      fhead = { 0 , 0 };
        !            20: struct stringlist      *flist = &fhead;
        !            21: struct stringlist      Fhead = { 0 , 0 };
        !            22: struct stringlist      *Flist = &Fhead;
        !            23: struct stringlist      ehead = { 0 , 0 };
        !            24: struct stringlist      *elist = &ehead;
        !            25: struct stringlist      Ehead = { 0 , 0 };
        !            26: struct stringlist      *Elist = &Ehead;
        !            27: 
        !            28: addlist( listp , funcname )
        !            29:     struct stringlist  *listp;
        !            30:     char               *funcname;
        !            31: {
        !            32:     struct stringlist  *slp;
        !            33: 
        !            34:     slp = (struct stringlist *) malloc( sizeof(struct stringlist));
        !            35:     if ( slp == (struct stringlist *) 0 ) {
        !            36:        fprintf( stderr, "gprof: ran out room for printlist\n" );
        !            37:        done();
        !            38:     }
        !            39:     slp -> next = listp -> next;
        !            40:     slp -> string = funcname;
        !            41:     listp -> next = slp;
        !            42: }
        !            43: 
        !            44: bool
        !            45: onlist( listp , funcname )
        !            46:     struct stringlist  *listp;
        !            47:     char               *funcname;
        !            48: {
        !            49:     struct stringlist  *slp;
        !            50: 
        !            51:     for ( slp = listp -> next ; slp ; slp = slp -> next ) {
        !            52:        if ( ! strcmp( slp -> string , funcname ) ) {
        !            53:            return TRUE;
        !            54:        }
        !            55:        if ( funcname[0] == '_' && ! strcmp( slp -> string , &funcname[1] ) ) {
        !            56:            return TRUE;
        !            57:        }
        !            58:     }
        !            59:     return FALSE;
        !            60: }

unix.superglobalmegacorp.com

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