Remove warnings in the update client and server
[openafs.git] / src / update / utils.c
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 #include <afsconfig.h>
11 #include <afs/param.h>
12
13
14 #include <afs/stds.h>
15 #include <rx/rxkad.h>
16 #include "global.h"
17 #ifdef AFS_NT40_ENV
18 #include <afs/errmap_nt.h>
19 #include <afs/afsutil.h>
20 #include <WINNT/afssw.h>
21 #endif
22 #include <stdio.h>
23 #include <string.h>
24 #ifdef HAVE_UNISTD_H
25 #include <unistd.h>
26 #endif
27 #include <stdlib.h>
28
29 int
30 AddToList(struct filestr **ah, char *aname)
31 {
32     register struct filestr *tf;
33     tf = (struct filestr *)malloc(sizeof(struct filestr));
34     tf->next = *ah;
35     *ah = tf;
36     tf->name = (char *)malloc(strlen(aname) + 1);
37     strcpy(tf->name, aname);
38     return 0;
39 }
40
41 int
42 ZapList(struct filestr **ah)
43 {
44     register struct filestr *tf, *nf;
45     for (tf = *ah; tf; tf = nf) {
46         nf = tf->next;          /* save before freeing */
47         free(tf->name);
48         free(tf);
49     }
50     *ah = NULL;
51     return 0;
52 }