dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / sgs / gprof / common / printlist.c
bloba5d1878d9172b317501b5008392a0bd38b473717
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
24 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
28 #pragma ident "%Z%%M% %I% %E% SMI"
30 #include "gprof.h"
33 * these are the lists of names:
34 * there is the list head and then the listname
35 * is a pointer to the list head
36 * (for ease of passing to stringlist functions).
38 struct stringlist fhead = { 0, 0 };
39 struct stringlist *flist = &fhead;
40 struct stringlist Fhead = { 0, 0 };
41 struct stringlist *Flist = &Fhead;
42 struct stringlist ehead = { 0, 0 };
43 struct stringlist *elist = &ehead;
44 struct stringlist Ehead = { 0, 0 };
45 struct stringlist *Elist = &Ehead;
47 void
48 addlist(struct stringlist *listp, char *funcname)
50 struct stringlist *slp;
52 slp = malloc(sizeof (struct stringlist));
54 if (slp == NULL) {
55 (void) fprintf(stderr, "gprof: ran out room for printlist\n");
56 exit(1);
59 slp->next = listp->next;
60 slp->string = funcname;
61 listp->next = slp;
64 bool
65 onlist(struct stringlist *listp, char *funcname)
67 struct stringlist *slp;
69 for (slp = listp->next; slp; slp = slp->next) {
70 if (strcmp(slp->string, funcname) == 0)
71 return (TRUE);
73 if (funcname[0] == '_' &&
74 strcmp(slp->string, &funcname[1]) == 0)
75 return (TRUE);
77 return (FALSE);