From e33f1dc0b6ec497133903918f1918adfa46f10ea Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Thu, 17 May 2012 13:29:42 +0100 Subject: [PATCH] xstat: Don't cast returns from malloc() 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: Iaddc6c44041dc77a576f32133b2aa80aefce5cb2 Reviewed-on: http://gerrit.openafs.org/7469 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/xstat/xstat_cm.c | 6 +++--- src/xstat/xstat_cm_test.c | 5 ++--- src/xstat/xstat_fs.c | 6 +++--- src/xstat/xstat_fs_callback.c | 2 +- src/xstat/xstat_fs_test.c | 2 +- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/xstat/xstat_cm.c b/src/xstat/xstat_cm.c index c7227d224..31ced2bd1 100644 --- a/src/xstat/xstat_cm.c +++ b/src/xstat/xstat_cm.c @@ -448,7 +448,7 @@ xstat_cm_Init(int a_numServers, struct sockaddr_in *a_socketArray, xstat_cm_ProbeFreqInSecs = a_ProbeFreqInSecs; xstat_cm_numCollections = a_numCollections; collIDBytes = xstat_cm_numCollections * sizeof(afs_int32); - xstat_cm_collIDP = (afs_int32 *) (malloc(collIDBytes)); + xstat_cm_collIDP = malloc(collIDBytes); memcpy(xstat_cm_collIDP, a_collIDP, collIDBytes); if (xstat_cm_debug) { printf("[%s] Asking for %d collection(s): ", rn, @@ -470,8 +470,8 @@ xstat_cm_Init(int a_numServers, struct sockaddr_in *a_socketArray, * Allocate the necessary data structures and initialize everything * else. */ - xstat_cm_ConnInfo = (struct xstat_cm_ConnectionInfo *) - malloc(a_numServers * sizeof(struct xstat_cm_ConnectionInfo)); + xstat_cm_ConnInfo = malloc(a_numServers + * sizeof(struct xstat_cm_ConnectionInfo)); if (xstat_cm_ConnInfo == (struct xstat_cm_ConnectionInfo *)0) { fprintf(stderr, "[%s] Can't allocate %d connection info structs (%" AFS_SIZET_FMT " bytes)\n", diff --git a/src/xstat/xstat_cm_test.c b/src/xstat/xstat_cm_test.c index 50c495683..71e6fc5b7 100644 --- a/src/xstat/xstat_cm_test.c +++ b/src/xstat/xstat_cm_test.c @@ -1459,8 +1459,7 @@ RunTheTest(struct cmd_syndesc *a_s, void *arock) if (debugging_on) printf("%s: Allocating socket array for %d Cache Manager(s)\n", rn, numCMs); - CMSktArray = (struct sockaddr_in *) - malloc(numCMs * sizeof(struct sockaddr_in)); + CMSktArray = malloc(numCMs * sizeof(struct sockaddr_in)); if (CMSktArray == (struct sockaddr_in *)0) { printf("%s: Can't allocate socket array for %d Cache Managers\n", rn, numCMs); @@ -1494,7 +1493,7 @@ RunTheTest(struct cmd_syndesc *a_s, void *arock) */ if (debugging_on) printf("Allocating %d long(s) for coll ID\n", numCollIDs); - collIDP = (afs_int32 *) (malloc(numCollIDs * sizeof(afs_int32))); + collIDP = malloc(numCollIDs * sizeof(afs_int32)); currCollIDP = collIDP; curr_item = a_s->parms[P_COLL_IDS].items; for (currCollIDIdx = 0; currCollIDIdx < numCollIDs; currCollIDIdx++) { diff --git a/src/xstat/xstat_fs.c b/src/xstat/xstat_fs.c index e157bb970..e35469ebd 100644 --- a/src/xstat/xstat_fs.c +++ b/src/xstat/xstat_fs.c @@ -477,7 +477,7 @@ xstat_fs_Init(int a_numServers, struct sockaddr_in *a_socketArray, xstat_fs_ProbeFreqInSecs = a_ProbeFreqInSecs; xstat_fs_numCollections = a_numCollections; collIDBytes = xstat_fs_numCollections * sizeof(afs_int32); - xstat_fs_collIDP = (afs_int32 *) (malloc(collIDBytes)); + xstat_fs_collIDP = malloc(collIDBytes); memcpy(xstat_fs_collIDP, a_collIDP, collIDBytes); if (xstat_fs_debug) { printf("[%s] Asking for %d collection(s): ", rn, @@ -499,8 +499,8 @@ xstat_fs_Init(int a_numServers, struct sockaddr_in *a_socketArray, * Allocate the necessary data structures and initialize everything * else. */ - xstat_fs_ConnInfo = (struct xstat_fs_ConnectionInfo *) - malloc(a_numServers * sizeof(struct xstat_fs_ConnectionInfo)); + xstat_fs_ConnInfo = malloc(a_numServers + * sizeof(struct xstat_fs_ConnectionInfo)); if (xstat_fs_ConnInfo == (struct xstat_fs_ConnectionInfo *)0) { fprintf(stderr, "[%s] Can't allocate %d connection info structs (%" AFS_SIZET_FMT " bytes)\n", diff --git a/src/xstat/xstat_fs_callback.c b/src/xstat/xstat_fs_callback.c index 35b6a7ca4..05c3e4d2b 100644 --- a/src/xstat/xstat_fs_callback.c +++ b/src/xstat/xstat_fs_callback.c @@ -696,7 +696,7 @@ SRXAFSCB_GetLocalCell(struct rx_call * a_call, char **a_name) { char *t_name; - t_name = (char *)malloc(AFSNAMEMAX); + t_name = malloc(AFSNAMEMAX); if (!t_name) return ENOMEM; strcpy(t_name, "This is xstat_fs"); diff --git a/src/xstat/xstat_fs_test.c b/src/xstat/xstat_fs_test.c index c90fd036f..413d15cbf 100644 --- a/src/xstat/xstat_fs_test.c +++ b/src/xstat/xstat_fs_test.c @@ -726,7 +726,7 @@ RunTheTest(struct cmd_syndesc *a_s, void *dummy) */ if (debugging_on) printf("Allocating %d long(s) for coll ID\n", numCollIDs); - collIDP = (afs_int32 *) (malloc(numCollIDs * sizeof(afs_int32))); + collIDP = malloc(numCollIDs * sizeof(afs_int32)); currCollIDP = collIDP; curr_item = a_s->parms[P_COLL_IDS].items; for (currCollIDIdx = 0; currCollIDIdx < numCollIDs; currCollIDIdx++) { -- 2.39.5