Revision 12269,
1.2 KB
checked in by ghudson, 26 years ago
(diff) |
This commit was generated by cvs2svn to compensate for changes in r12268,
which included commits to RCS files with non-trunk default branches.
|
Line | |
---|
1 | /* |
---|
2 | * Copyright (c) 1992-1998 Michael A. Cooper. |
---|
3 | * This software may be freely used and distributed provided it is not |
---|
4 | * sold for profit or used in part or in whole for commercial gain |
---|
5 | * without prior written agreement, and the author is credited |
---|
6 | * appropriately. |
---|
7 | */ |
---|
8 | |
---|
9 | #ifndef lint |
---|
10 | static char *RCSid = "$Revision: 1.1.1.3 $"; |
---|
11 | #endif |
---|
12 | |
---|
13 | /* |
---|
14 | * Name list routines. |
---|
15 | */ |
---|
16 | |
---|
17 | #include "defs.h" |
---|
18 | |
---|
19 | extern namelist_t *NameListFind(List, Name) |
---|
20 | namelist_t *List; |
---|
21 | char *Name; |
---|
22 | { |
---|
23 | register namelist_t *Ptr; |
---|
24 | |
---|
25 | for (Ptr = List; Ptr; Ptr = Ptr->nl_next) |
---|
26 | if (EQ(Ptr->nl_name, Name)) |
---|
27 | return(Ptr); |
---|
28 | |
---|
29 | return((namelist_t *) NULL); |
---|
30 | } |
---|
31 | |
---|
32 | extern void NameListAdd(List, Name) |
---|
33 | namelist_t **List; |
---|
34 | char *Name; |
---|
35 | { |
---|
36 | register namelist_t *Ptr; |
---|
37 | |
---|
38 | Ptr = (namelist_t *) xmalloc(sizeof(namelist_t)); |
---|
39 | Ptr->nl_name = strdup(Name); |
---|
40 | Ptr->nl_next = (namelist_t *) NULL; |
---|
41 | |
---|
42 | if (List && *List) |
---|
43 | Ptr->nl_next = *List; |
---|
44 | |
---|
45 | *List = Ptr; |
---|
46 | } |
---|
47 | |
---|
48 | extern void NameListFree(List) |
---|
49 | namelist_t *List; |
---|
50 | { |
---|
51 | register namelist_t *Ptr; |
---|
52 | register namelist_t *LastPtr; |
---|
53 | |
---|
54 | for (Ptr = List; Ptr; ) { |
---|
55 | if (Ptr->nl_name) |
---|
56 | (void) free(Ptr->nl_name); |
---|
57 | LastPtr = Ptr; |
---|
58 | Ptr = Ptr->nl_next; |
---|
59 | (void) free(LastPtr); |
---|
60 | } |
---|
61 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.