update: Don't cast returns from malloc()
[openafs.git] / src / update / utils.c
index db1f4f2..1d5dc6a 100644 (file)
@@ -1,72 +1,48 @@
 /*
  * Copyright 2000, International Business Machines Corporation and others.
  * All Rights Reserved.
- * 
+ *
  * This software has been released under the terms of the IBM Public
  * License.  For details, see the LICENSE file in the top-level source
  * directory or online at http://www.openafs.org/dl/license10.html
  */
 
-#include <afs/param.h>
 #include <afsconfig.h>
+#include <afs/param.h>
+#include <afs/stds.h>
 
-RCSID("$Header$");
+#include <roken.h>
 
-#include <afs/stds.h>
-#include <rx/rxkad.h>
-#include "global.h"
 #ifdef AFS_NT40_ENV
 #include <afs/errmap_nt.h>
 #include <afs/afsutil.h>
 #include <WINNT/afssw.h>
 #endif
-#include <stdio.h>
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#else
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <stdlib.h>
+
+#include <rx/rxkad.h>
+#include "global.h"
+
 
 int
-AddToList(ah, aname)
-struct filestr **ah;
-char *aname; {
-    register struct filestr *tf;
-    tf = (struct filestr *) malloc(sizeof(struct filestr));
+AddToList(struct filestr **ah, char *aname)
+{
+    struct filestr *tf;
+    tf = malloc(sizeof(struct filestr));
     tf->next = *ah;
     *ah = tf;
-    tf->name = (char *) malloc(strlen(aname)+1);
-    strcpy(tf->name, aname);
+    tf->name = strdup(aname);
     return 0;
 }
 
 int
-ZapList(ah)
-struct filestr **ah; {
-    register struct filestr *tf, *nf;
-    for(tf = *ah; tf; tf=nf) {
-       nf = tf->next;      /* save before freeing */
+ZapList(struct filestr **ah)
+{
+    struct filestr *tf, *nf;
+    for (tf = *ah; tf; tf = nf) {
+       nf = tf->next;          /* save before freeing */
        free(tf->name);
        free(tf);
     }
-    *ah = (struct filestr *) 0;
+    *ah = NULL;
     return 0;
 }
-
-/* StringToLevel - converts the name of an rxkad security level to a integer
- * suitable for calling rxkad_New*SecurityObject. */
-
-rxkad_level StringToLevel (name)
-  char *name;
-{
-    if (strcmp (name, "clear") == 0) return rxkad_clear;
-    if (strcmp (name, "auth") == 0) return rxkad_auth;
-    if (strcmp (name, "crypt") == 0) return rxkad_crypt;
-    return -1;
-}