Commit | Line | Data |
---|---|---|
98a06e30 PK |
1 | #ifndef lint |
2 | static char *sccsid = "@(#)printlist.c 1.1 (Berkeley) %G%"; | |
3 | #endif lint | |
4 | ||
5 | #include "gprof.h" | |
6 | ||
7 | struct stringlist { | |
8 | struct stringlist *next; | |
9 | char *string; | |
10 | }; | |
11 | ||
12 | struct stringlist fflaglist = { 0 , 0 }; | |
13 | ||
14 | addflist( funcname ) | |
15 | char *funcname; | |
16 | { | |
17 | struct stringlist *slp; | |
18 | ||
19 | slp = (struct stringlist *) malloc( sizeof(struct stringlist)); | |
20 | if ( slp == (struct stringlist *) 0 ) { | |
21 | fprintf( stderr, "gprof: ran out room for printlist\n" ); | |
22 | done(); | |
23 | } | |
24 | slp -> next = fflaglist.next; | |
25 | slp -> string = funcname; | |
26 | fflaglist.next = slp; | |
27 | } | |
28 | ||
29 | bool | |
30 | onflist( funcname ) | |
31 | char *funcname; | |
32 | { | |
33 | struct stringlist *slp; | |
34 | ||
35 | for ( slp = fflaglist.next ; slp ; slp = slp -> next ) { | |
36 | if ( ! strcmp( slp -> string , funcname ) ) { | |
37 | return TRUE; | |
38 | } | |
39 | if ( funcname[0] == '_' && ! strcmp( slp -> string , &funcname[1] ) ) { | |
40 | return TRUE; | |
41 | } | |
42 | } | |
43 | return FALSE; | |
44 | } | |
45 | ||
46 | struct stringlist eflaglist = { 0 , 0 }; | |
47 | ||
48 | addelist( funcname ) | |
49 | char *funcname; | |
50 | { | |
51 | struct stringlist *slp; | |
52 | ||
53 | slp = (struct stringlist *) malloc( sizeof(struct stringlist)); | |
54 | if ( slp == (struct stringlist *) 0 ) { | |
55 | fprintf( stderr, "gprof: ran out room for printlist\n" ); | |
56 | done(); | |
57 | } | |
58 | slp -> next = eflaglist.next; | |
59 | slp -> string = funcname; | |
60 | eflaglist.next = slp; | |
61 | } | |
62 | ||
63 | bool | |
64 | onelist( funcname ) | |
65 | char *funcname; | |
66 | { | |
67 | struct stringlist *slp; | |
68 | ||
69 | for ( slp = eflaglist.next ; slp ; slp = slp -> next ) { | |
70 | if ( ! strcmp( slp -> string , funcname ) ) { | |
71 | return TRUE; | |
72 | } | |
73 | if ( funcname[0] == '_' && ! strcmp( slp -> string , &funcname[1] ) ) { | |
74 | return TRUE; | |
75 | } | |
76 | } | |
77 | return FALSE; | |
78 | } |