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