Don't cast returns from malloc()
[openafs.git] / src / config / mc.c
index 18d2efc..97fc26e 100644 (file)
@@ -7,6 +7,8 @@
  * directory or online at http://www.openafs.org/dl/license10.html
  */
 
+#include "afsconfig.h"
+
 #define        MAXLINELEN      1024
 #define        MAXTOKLEN       100
 #include <sys/param.h>
@@ -15,7 +17,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "afsconfig.h"
 #include <string.h>
 
 #define TOK_DONTUSE 1          /* Don't copy if match and this flag is set. */
@@ -62,16 +63,14 @@ ParseLine(char *aline, struct token **alist)
                    return -1;  /* should never get here */
                else
                    *tptr++ = 0;
-               ttok = (struct token *)malloc(sizeof(struct token));
+               ttok = malloc(sizeof(struct token));
                ttok->next = NULL;
                if (dontUse) {
-                   ttok->key = (char *)malloc(strlen(tbuffer));
-                   strcpy(ttok->key, tbuffer + 1);
+                   ttok->key = strdup(tbuffer + 1); /* Skip first char */
                    ttok->flags = TOK_DONTUSE;
                    dontUse = 0;
                } else {
-                   ttok->key = (char *)malloc(strlen(tbuffer) + 1);
-                   strcpy(ttok->key, tbuffer);
+                   ttok->key = strdup(tbuffer);
                    ttok->flags = 0;
                }
                if (last) {