Commit | Line | Data |
---|---|---|
c0bc4ef7 DF |
1 | /* |
2 | * Copyright (c) 1983 Regents of the University of California. | |
ddb85eed KB |
3 | * All rights reserved. |
4 | * | |
5 | * Redistribution and use in source and binary forms are permitted | |
6 | * provided that this notice is preserved and that due credit is given | |
7 | * to the University of California at Berkeley. The name of the University | |
8 | * may not be used to endorse or promote products derived from this | |
9 | * software without specific prior written permission. This software | |
10 | * is provided ``as is'' without express or implied warranty. | |
c0bc4ef7 DF |
11 | */ |
12 | ||
98a06e30 | 13 | #ifndef lint |
ddb85eed KB |
14 | static char sccsid[] = "@(#)printlist.c 5.3 (Berkeley) %G%"; |
15 | #endif /* not lint */ | |
98a06e30 PK |
16 | |
17 | #include "gprof.h" | |
18 | ||
a441395b PK |
19 | /* |
20 | * these are the lists of names: | |
21 | * there is the list head and then the listname | |
22 | * is a pointer to the list head | |
23 | * (for ease of passing to stringlist functions). | |
24 | */ | |
3cdecae8 KM |
25 | struct stringlist kfromhead = { 0 , 0 }; |
26 | struct stringlist *kfromlist = &kfromhead; | |
27 | struct stringlist ktohead = { 0 , 0 }; | |
28 | struct stringlist *ktolist = &ktohead; | |
a441395b PK |
29 | struct stringlist fhead = { 0 , 0 }; |
30 | struct stringlist *flist = &fhead; | |
31 | struct stringlist Fhead = { 0 , 0 }; | |
32 | struct stringlist *Flist = &Fhead; | |
33 | struct stringlist ehead = { 0 , 0 }; | |
34 | struct stringlist *elist = &ehead; | |
35 | struct stringlist Ehead = { 0 , 0 }; | |
36 | struct stringlist *Elist = &Ehead; | |
37 | ||
38 | addlist( listp , funcname ) | |
39 | struct stringlist *listp; | |
40 | char *funcname; | |
98a06e30 PK |
41 | { |
42 | struct stringlist *slp; | |
43 | ||
44 | slp = (struct stringlist *) malloc( sizeof(struct stringlist)); | |
45 | if ( slp == (struct stringlist *) 0 ) { | |
46 | fprintf( stderr, "gprof: ran out room for printlist\n" ); | |
47 | done(); | |
48 | } | |
a441395b | 49 | slp -> next = listp -> next; |
98a06e30 | 50 | slp -> string = funcname; |
a441395b | 51 | listp -> next = slp; |
98a06e30 PK |
52 | } |
53 | ||
54 | bool | |
a441395b PK |
55 | onlist( listp , funcname ) |
56 | struct stringlist *listp; | |
57 | char *funcname; | |
98a06e30 PK |
58 | { |
59 | struct stringlist *slp; | |
60 | ||
a441395b | 61 | for ( slp = listp -> next ; slp ; slp = slp -> next ) { |
98a06e30 PK |
62 | if ( ! strcmp( slp -> string , funcname ) ) { |
63 | return TRUE; | |
64 | } | |
65 | if ( funcname[0] == '_' && ! strcmp( slp -> string , &funcname[1] ) ) { | |
66 | return TRUE; | |
67 | } | |
68 | } | |
69 | return FALSE; | |
70 | } |