Commit | Line | Data |
---|---|---|
c0bc4ef7 | 1 | /* |
7e9de516 KB |
2 | * Copyright (c) 1983, 1993 |
3 | * The Regents of the University of California. All rights reserved. | |
ddb85eed | 4 | * |
6ecf3d85 | 5 | * %sccs.include.redist.c% |
c0bc4ef7 DF |
6 | */ |
7 | ||
98a06e30 | 8 | #ifndef lint |
7e9de516 | 9 | static char sccsid[] = "@(#)printlist.c 8.1 (Berkeley) %G%"; |
ddb85eed | 10 | #endif /* not lint */ |
98a06e30 PK |
11 | |
12 | #include "gprof.h" | |
13 | ||
a441395b PK |
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 | */ | |
3cdecae8 KM |
20 | struct stringlist kfromhead = { 0 , 0 }; |
21 | struct stringlist *kfromlist = &kfromhead; | |
22 | struct stringlist ktohead = { 0 , 0 }; | |
23 | struct stringlist *ktolist = &ktohead; | |
a441395b PK |
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; | |
98a06e30 PK |
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 | } | |
a441395b | 44 | slp -> next = listp -> next; |
98a06e30 | 45 | slp -> string = funcname; |
a441395b | 46 | listp -> next = slp; |
98a06e30 PK |
47 | } |
48 | ||
49 | bool | |
a441395b PK |
50 | onlist( listp , funcname ) |
51 | struct stringlist *listp; | |
52 | char *funcname; | |
98a06e30 PK |
53 | { |
54 | struct stringlist *slp; | |
55 | ||
a441395b | 56 | for ( slp = listp -> next ; slp ; slp = slp -> next ) { |
98a06e30 PK |
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 | } |