sys: Don't cast returns from malloc()
authorSimon Wilkinson <sxw@your-file-system.com>
Thu, 17 May 2012 12:31:07 +0000 (13:31 +0100)
committerDerrick Brashear <shadow@dementix.org>
Thu, 24 May 2012 16:19:18 +0000 (09:19 -0700)
malloc() returns a (void *) on all of our current platforms. So,
don't bother casting the return value before assigning it - it is
unnecessary noise.

Change-Id: I58b7695e3cf4b99f17869a46e1efca5c7daf6ff7
Reviewed-on: http://gerrit.openafs.org/7470
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

src/sys/afssyscalls.c
src/sys/rmtsysc.c
src/sys/rmtsysnet.c
src/sys/rmtsyss.c

index 9780491..712e68c 100644 (file)
@@ -407,8 +407,7 @@ check_iops(int index, char *fun, char *file, int line)
        int avail = *availp;
        avail += IOPS_DEBUG_MALLOC_STEP;
        if (avail == IOPS_DEBUG_MALLOC_STEP)
-           iops_debug[index] =
-               (iops_debug_t *) malloc(avail * sizeof(iops_debug_t));
+           iops_debug[index] = malloc(avail * sizeof(iops_debug_t));
        else
            iops_debug[index] = realloc(*iops, avail * sizeof(iops_debug_t));
        if (!iops_debug[index]) {
index d5f0292..29c8996 100644 (file)
@@ -217,7 +217,7 @@ pioctl(char *path, afs_int32 cmd, struct ViceIoctl *data, afs_int32 follow)
     if (!ins)
        ins = 1;
 #endif
-    if (!(inbuffer = (char *)malloc(ins)))
+    if (!(inbuffer = malloc(ins)))
        return (-1);            /* helpless here */
     if (data->in_size)
        memcpy(inbuffer, data->in, data->in_size);
index 04d3f68..296145e 100644 (file)
@@ -73,7 +73,7 @@ RParseAcl(char *astr)
     sscanf(astr, "%d", &nminus);
     astr = RSkipLine(astr);
 
-    ta = (struct Acl *)malloc(sizeof(struct Acl));
+    ta = malloc(sizeof(struct Acl));
     ta->nplus = nplus;
     ta->nminus = nminus;
 
@@ -82,7 +82,7 @@ RParseAcl(char *astr)
     for (i = 0; i < nplus; i++) {
        sscanf(astr, "%100s %d", tname, &trights);
        astr = RSkipLine(astr);
-       tl = (struct AclEntry *)malloc(sizeof(struct AclEntry));
+       tl = malloc(sizeof(struct AclEntry));
        if (!first)
            first = tl;
        strcpy(tl->name, tname);
@@ -99,7 +99,7 @@ RParseAcl(char *astr)
     for (i = 0; i < nminus; i++) {
        sscanf(astr, "%100s %d", tname, &trights);
        astr = RSkipLine(astr);
-       tl = (struct AclEntry *)malloc(sizeof(struct AclEntry));
+       tl = malloc(sizeof(struct AclEntry));
        if (!first)
            first = tl;
        strcpy(tl->name, tname);
index ec135e2..eeecc84 100644 (file)
@@ -119,9 +119,7 @@ SRMTSYS_Pioctl(struct rx_call *call, clientcred *creds, char *path,
     *errornumber = 0;
     SETCLIENTCONTEXT(blob, rx_HostOf(rx_PeerOf(rx_ConnectionOf(call))), creds->uid,
                     creds->group0, creds->group1, cmd, NFS_EXPORTER);
-    data.in =
-       (char *)malloc(InData->rmtbulk_len +
-                      PIOCTL_HEADER * sizeof(afs_int32));
+    data.in = malloc(InData->rmtbulk_len + PIOCTL_HEADER * sizeof(afs_int32));
     if (!data.in)
        return (-1);            /* helpless here */
     if (!strcmp(path, NIL_PATHP))