Commit | Line | Data |
---|---|---|
98a06e30 | 1 | #ifndef lint |
a441395b | 2 | static char *sccsid = "@(#)printlist.c 1.2 (Berkeley) %G%"; |
98a06e30 PK |
3 | #endif lint |
4 | ||
5 | #include "gprof.h" | |
6 | ||
a441395b PK |
7 | /* |
8 | * these are the lists of names: | |
9 | * there is the list head and then the listname | |
10 | * is a pointer to the list head | |
11 | * (for ease of passing to stringlist functions). | |
12 | */ | |
13 | struct stringlist fhead = { 0 , 0 }; | |
14 | struct stringlist *flist = &fhead; | |
15 | struct stringlist Fhead = { 0 , 0 }; | |
16 | struct stringlist *Flist = &Fhead; | |
17 | struct stringlist ehead = { 0 , 0 }; | |
18 | struct stringlist *elist = &ehead; | |
19 | struct stringlist Ehead = { 0 , 0 }; | |
20 | struct stringlist *Elist = &Ehead; | |
21 | ||
22 | addlist( listp , funcname ) | |
23 | struct stringlist *listp; | |
24 | char *funcname; | |
98a06e30 PK |
25 | { |
26 | struct stringlist *slp; | |
27 | ||
28 | slp = (struct stringlist *) malloc( sizeof(struct stringlist)); | |
29 | if ( slp == (struct stringlist *) 0 ) { | |
30 | fprintf( stderr, "gprof: ran out room for printlist\n" ); | |
31 | done(); | |
32 | } | |
a441395b | 33 | slp -> next = listp -> next; |
98a06e30 | 34 | slp -> string = funcname; |
a441395b | 35 | listp -> next = slp; |
98a06e30 PK |
36 | } |
37 | ||
38 | bool | |
a441395b PK |
39 | onlist( listp , funcname ) |
40 | struct stringlist *listp; | |
41 | char *funcname; | |
98a06e30 PK |
42 | { |
43 | struct stringlist *slp; | |
44 | ||
a441395b | 45 | for ( slp = listp -> next ; slp ; slp = slp -> next ) { |
98a06e30 PK |
46 | if ( ! strcmp( slp -> string , funcname ) ) { |
47 | return TRUE; | |
48 | } | |
49 | if ( funcname[0] == '_' && ! strcmp( slp -> string , &funcname[1] ) ) { | |
50 | return TRUE; | |
51 | } | |
52 | } | |
53 | return FALSE; | |
54 | } |