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