date and time created 87/02/05 15:19:02 by slatteng
[unix-history] / usr / src / usr.bin / gprof / printlist.c
CommitLineData
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
8static 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 */
19struct stringlist fhead = { 0 , 0 };
20struct stringlist *flist = &fhead;
21struct stringlist Fhead = { 0 , 0 };
22struct stringlist *Flist = &Fhead;
23struct stringlist ehead = { 0 , 0 };
24struct stringlist *elist = &ehead;
25struct stringlist Ehead = { 0 , 0 };
26struct stringlist *Elist = &Ehead;
27
28addlist( 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
44bool
a441395b
PK
45onlist( 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}