Annotation of 43BSDReno/pgrm/gprof/printlist.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1983 Regents of the University of California.
        !             3:  * All rights reserved.
        !             4:  *
        !             5:  * Redistribution and use in source and binary forms are permitted
        !             6:  * provided that: (1) source distributions retain this entire copyright
        !             7:  * notice and comment, and (2) distributions including binaries display
        !             8:  * the following acknowledgement:  ``This product includes software
        !             9:  * developed by the University of California, Berkeley and its contributors''
        !            10:  * in the documentation or other materials provided with the distribution
        !            11:  * and in all advertising materials mentioning features or use of this
        !            12:  * software. Neither the name of the University nor the names of its
        !            13:  * contributors may be used to endorse or promote products derived
        !            14:  * from this software without specific prior written permission.
        !            15:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
        !            16:  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
        !            17:  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
        !            18:  */
        !            19: 
        !            20: #ifndef lint
        !            21: static char sccsid[] = "@(#)printlist.c        5.5 (Berkeley) 6/1/90";
        !            22: #endif /* not lint */
        !            23: 
        !            24: #include "gprof.h"
        !            25: 
        !            26:     /*
        !            27:      * these are the lists of names:
        !            28:      * there is the list head and then the listname
        !            29:      * is a pointer to the list head
        !            30:      * (for ease of passing to stringlist functions).
        !            31:      */
        !            32: struct stringlist      kfromhead = { 0 , 0 };
        !            33: struct stringlist      *kfromlist = &kfromhead;
        !            34: struct stringlist      ktohead = { 0 , 0 };
        !            35: struct stringlist      *ktolist = &ktohead;
        !            36: struct stringlist      fhead = { 0 , 0 };
        !            37: struct stringlist      *flist = &fhead;
        !            38: struct stringlist      Fhead = { 0 , 0 };
        !            39: struct stringlist      *Flist = &Fhead;
        !            40: struct stringlist      ehead = { 0 , 0 };
        !            41: struct stringlist      *elist = &ehead;
        !            42: struct stringlist      Ehead = { 0 , 0 };
        !            43: struct stringlist      *Elist = &Ehead;
        !            44: 
        !            45: addlist( listp , funcname )
        !            46:     struct stringlist  *listp;
        !            47:     char               *funcname;
        !            48: {
        !            49:     struct stringlist  *slp;
        !            50: 
        !            51:     slp = (struct stringlist *) malloc( sizeof(struct stringlist));
        !            52:     if ( slp == (struct stringlist *) 0 ) {
        !            53:        fprintf( stderr, "gprof: ran out room for printlist\n" );
        !            54:        done();
        !            55:     }
        !            56:     slp -> next = listp -> next;
        !            57:     slp -> string = funcname;
        !            58:     listp -> next = slp;
        !            59: }
        !            60: 
        !            61: bool
        !            62: onlist( listp , funcname )
        !            63:     struct stringlist  *listp;
        !            64:     char               *funcname;
        !            65: {
        !            66:     struct stringlist  *slp;
        !            67: 
        !            68:     for ( slp = listp -> next ; slp ; slp = slp -> next ) {
        !            69:        if ( ! strcmp( slp -> string , funcname ) ) {
        !            70:            return TRUE;
        !            71:        }
        !            72:        if ( funcname[0] == '_' && ! strcmp( slp -> string , &funcname[1] ) ) {
        !            73:            return TRUE;
        !            74:        }
        !            75:     }
        !            76:     return FALSE;
        !            77: }

unix.superglobalmegacorp.com

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