mirror of
https://git.openafs.org/openafs.git
synced 2025-01-19 15:30:14 +00:00
Don't cast the return from calloc()
calloc returns a (void *) argument. So we don't need to cast its output before storing it. Change-Id: Ibdfc61a8a2cf9779a0bfb17ff8ebf1f3bef3ea0e Reviewed-on: http://gerrit.openafs.org/7456 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@dementix.org>
This commit is contained in:
parent
bdd8187c04
commit
9547615445
@ -57,7 +57,7 @@ ll_node *ll_add_node(linked_list *list, ll_end which_end)
|
||||
{
|
||||
ll_node *node = NULL;
|
||||
|
||||
if ((node = (ll_node *)calloc(1, sizeof(ll_node))) != NULL) {
|
||||
if ((node = calloc(1, sizeof(ll_node))) != NULL) {
|
||||
if (list->nelements == 0) {
|
||||
list->first = node;
|
||||
list->last = node;
|
||||
@ -156,8 +156,7 @@ int ll_string(linked_list *list, ll_s_action action, char *string)
|
||||
if (!ll_string(list, ll_s_check, string)) {
|
||||
if ((cur_node = ll_add_node(list, ll_tail))) {
|
||||
char *new_string;
|
||||
if ((new_string = (char *)calloc(strlen(string) + 1,
|
||||
sizeof(char)))) {
|
||||
if ((new_string = calloc(strlen(string) + 1, sizeof(char)))) {
|
||||
strcpy(new_string, string);
|
||||
ll_add_data(cur_node, new_string);
|
||||
}
|
||||
|
@ -228,8 +228,7 @@ util_DatabaseServerGetBegin(const char *cellName, void **iterationIdP,
|
||||
afs_status_t tst = 0;
|
||||
afs_admin_iterator_p iter =
|
||||
(afs_admin_iterator_p) malloc(sizeof(afs_admin_iterator_t));
|
||||
database_server_get_p serv =
|
||||
(database_server_get_p) calloc(1, sizeof(database_server_get_t));
|
||||
database_server_get_p serv = calloc(1, sizeof(database_server_get_t));
|
||||
char copyCell[MAXCELLCHARS];
|
||||
|
||||
/*
|
||||
|
@ -1824,7 +1824,7 @@ afsclient_AFSServerGetBegin(const void *cellHandle, void **iterationIdP,
|
||||
afs_cell_handle_p c_handle = (afs_cell_handle_p) cellHandle;
|
||||
afs_admin_iterator_p iter =
|
||||
(afs_admin_iterator_p) malloc(sizeof(afs_admin_iterator_t));
|
||||
server_get_p serv = (server_get_p) calloc(1, sizeof(server_get_t));
|
||||
server_get_p serv = calloc(1, sizeof(server_get_t));
|
||||
server_get_p serv_cache = NULL;
|
||||
const char *cellName = NULL;
|
||||
void *database_iter;
|
||||
|
@ -689,8 +689,7 @@ vos_PartitionGetBegin(const void *cellHandle, const void *serverHandle,
|
||||
file_server_p f_server = (file_server_p) serverHandle;
|
||||
afs_admin_iterator_p iter =
|
||||
(afs_admin_iterator_p) malloc(sizeof(afs_admin_iterator_t));
|
||||
partition_get_p part =
|
||||
(partition_get_p) calloc(1, sizeof(partition_get_t));
|
||||
partition_get_p part = calloc(1, sizeof(partition_get_t));
|
||||
|
||||
/*
|
||||
* Validate arguments
|
||||
@ -1336,7 +1335,7 @@ vos_FileServerGetBegin(const void *cellHandle, vos_MessageCallBack_t callBack,
|
||||
afs_cell_handle_p c_handle = (afs_cell_handle_p) cellHandle;
|
||||
afs_admin_iterator_p iter =
|
||||
(afs_admin_iterator_p) malloc(sizeof(afs_admin_iterator_t));
|
||||
server_get_p serv = (server_get_p) calloc(1, sizeof(server_get_t));
|
||||
server_get_p serv = calloc(1, sizeof(server_get_t));
|
||||
struct VLCallBack unused;
|
||||
|
||||
|
||||
@ -1675,8 +1674,7 @@ vos_ServerTransactionStatusGetBegin(const void *cellHandle,
|
||||
file_server_p f_server = (file_server_p) serverHandle;
|
||||
afs_admin_iterator_p iter =
|
||||
(afs_admin_iterator_p) malloc(sizeof(afs_admin_iterator_t));
|
||||
transaction_get_p tran =
|
||||
(transaction_get_p) calloc(1, sizeof(transaction_get_t));
|
||||
transaction_get_p tran = calloc(1, sizeof(transaction_get_t));
|
||||
|
||||
|
||||
/*
|
||||
@ -2125,8 +2123,7 @@ vos_VLDBGetBegin(const void *cellHandle, const void *serverHandle,
|
||||
file_server_p f_server = (file_server_p) serverHandle;
|
||||
afs_admin_iterator_p iter =
|
||||
(afs_admin_iterator_p) malloc(sizeof(afs_admin_iterator_t));
|
||||
vldb_entry_get_p entry =
|
||||
(vldb_entry_get_p) calloc(1, sizeof(vldb_entry_get_t));
|
||||
vldb_entry_get_p entry = calloc(1, sizeof(vldb_entry_get_t));
|
||||
struct VldbListByAttributes attr;
|
||||
|
||||
attr.Mask = 0;
|
||||
@ -3806,7 +3803,7 @@ vos_VolumeGetBegin(const void *cellHandle, const void *serverHandle,
|
||||
file_server_p f_server = (file_server_p) serverHandle;
|
||||
afs_admin_iterator_p iter =
|
||||
(afs_admin_iterator_p) malloc(sizeof(afs_admin_iterator_t));
|
||||
volume_get_p entry = (volume_get_p) calloc(1, sizeof(volume_get_t));
|
||||
volume_get_p entry = calloc(1, sizeof(volume_get_t));
|
||||
|
||||
/*
|
||||
* Validate arguments
|
||||
|
@ -231,7 +231,7 @@ main(int argc, char **argv)
|
||||
/* Now create readers */
|
||||
printf("[Creating Readers...\n");
|
||||
readers = (PROCESS *) calloc(nreaders, sizeof(PROCESS));
|
||||
readerid = (int *)calloc(nreaders, sizeof(i));
|
||||
readerid = calloc(nreaders, sizeof(i));
|
||||
for (i = 0; i < nreaders; i++)
|
||||
LWP_CreateProcess(read_process, STACK_SIZE, 0, (void *)&readerid[i],
|
||||
"Reader", &readers[i]);
|
||||
|
@ -156,8 +156,7 @@ GetDescription(rpcArgs * argsP)
|
||||
char *bufP2;
|
||||
int i;
|
||||
|
||||
bufP2 =
|
||||
(char *)calloc((MAX_TYP_STR + MAX_DIR_STR + ATTRIB_LEN * ATTRIB_NO)
|
||||
bufP2 = calloc((MAX_TYP_STR + MAX_DIR_STR + ATTRIB_LEN * ATTRIB_NO)
|
||||
* argsP->argCount + 3, sizeof(char));
|
||||
MEM_CHK(bufP2, "GetDescription: out of mem bufP2\n");
|
||||
|
||||
@ -312,8 +311,8 @@ GetRandP(char *typ, char **ret, char **ret2)
|
||||
double d, d1;
|
||||
short shI;
|
||||
|
||||
*ret = (char *)calloc(MAX_RAND_LENGTH + 1, sizeof(char));
|
||||
*ret2 = (char *)calloc(MAX_RAND_LENGTH + 1, sizeof(char));
|
||||
*ret = calloc(MAX_RAND_LENGTH + 1, sizeof(char));
|
||||
*ret2 = calloc(MAX_RAND_LENGTH + 1, sizeof(char));
|
||||
|
||||
if (strstr(typ, "char")) {
|
||||
GetRandStr(1, ret2, &randI);
|
||||
|
@ -497,7 +497,7 @@ setup(dev)
|
||||
#else /* AFS_SUN5_ENV */
|
||||
#if defined(AFS_HPUX110_ENV)
|
||||
size = fragroundup(&sblock, sblock.fs_cssize);
|
||||
sblock.fs_csp = (struct csum *)calloc(1, (unsigned)size);
|
||||
sblock.fs_csp = calloc(1, (unsigned)size);
|
||||
if ((bread
|
||||
(fsreadfd, (char *)sblock.fs_csp, fsbtodb(&sblock, sblock.fs_csaddr),
|
||||
size) != 0) && !asked) {
|
||||
@ -517,7 +517,7 @@ setup(dev)
|
||||
sblock.fs_cssize - i <
|
||||
sblock.fs_bsize ? sblock.fs_cssize - i : sblock.fs_bsize;
|
||||
#endif /* AFS_HPUX101_ENV */
|
||||
sblock.fs_csp[j] = (struct csum *)calloc(1, (unsigned)size);
|
||||
sblock.fs_csp[j] = calloc(1, (unsigned)size);
|
||||
if (bread
|
||||
(fsreadfd, (char *)sblock.fs_csp[j],
|
||||
fsbtodb(&sblock, sblock.fs_csaddr + j * sblock.fs_frag),
|
||||
@ -574,7 +574,7 @@ setup(dev)
|
||||
msgprintf("cannot alloc %d bytes for statemap\n", maxino + 1);
|
||||
goto badsb;
|
||||
}
|
||||
lncntp = (short *)calloc((unsigned)(maxino + 1), sizeof(short));
|
||||
lncntp = calloc((unsigned)(maxino + 1), sizeof(short));
|
||||
if (lncntp == NULL) {
|
||||
msgprintf("cannot alloc %d bytes for lncntp\n",
|
||||
(maxino + 1) * sizeof(short));
|
||||
|
@ -936,7 +936,7 @@ hasvfsopt(vfs, opt)
|
||||
if (vfs->vfs_mntopts == NULL)
|
||||
return (NULL);
|
||||
if (tmpopts == 0) {
|
||||
tmpopts = (char *)calloc(256, sizeof(char));
|
||||
tmpopts = calloc(256, sizeof(char));
|
||||
if (tmpopts == 0)
|
||||
return (0);
|
||||
}
|
||||
|
@ -535,7 +535,7 @@ AttachVolume(struct DiskPartition64 * dp, char *volname,
|
||||
vp->shuttingDown = 0;
|
||||
vp->goingOffline = 0;
|
||||
vp->nUsers = 1;
|
||||
vp->header = (struct volHeader *)calloc(1, sizeof(*vp->header));
|
||||
vp->header = calloc(1, sizeof(*vp->header));
|
||||
if (!vp->header) {
|
||||
fprintf(stderr, "%s: Failed to allocate volume header.\n", progname);
|
||||
free(vp);
|
||||
|
@ -8053,7 +8053,7 @@ GetVolumeHeader(Volume * vp)
|
||||
if (programType != fileServer) {
|
||||
/* for volume utilities, we allocate volHeaders as needed */
|
||||
if (!vp->header) {
|
||||
hd = (struct volHeader *)calloc(1, sizeof(*vp->header));
|
||||
hd = calloc(1, sizeof(*vp->header));
|
||||
osi_Assert(hd != NULL);
|
||||
vp->header = hd;
|
||||
hd->back = vp;
|
||||
@ -8077,7 +8077,7 @@ GetVolumeHeader(Volume * vp)
|
||||
if (!hd) {
|
||||
/* LRU is empty, so allocate a new volHeader
|
||||
* this is probably indicative of a leak, so let the user know */
|
||||
hd = (struct volHeader *)calloc(1, sizeof(struct volHeader));
|
||||
hd = calloc(1, sizeof(struct volHeader));
|
||||
osi_Assert(hd != NULL);
|
||||
if (!everLogged) {
|
||||
Log("****Allocated more volume headers, probably leak****\n");
|
||||
|
@ -103,7 +103,7 @@ AttachVolume(struct DiskPartition64 * dp, char *volname,
|
||||
vp->shuttingDown = 0;
|
||||
vp->goingOffline = 0;
|
||||
vp->nUsers = 1;
|
||||
vp->header = (struct volHeader *)calloc(1, sizeof(*vp->header));
|
||||
vp->header = calloc(1, sizeof(*vp->header));
|
||||
ec = ReadHdr1(V_diskDataHandle(vp), (char *)&V_disk(vp),
|
||||
sizeof(V_disk(vp)), VOLUMEINFOMAGIC, VOLUMEINFOVERSION);
|
||||
if (!ec) {
|
||||
|
Loading…
Reference in New Issue
Block a user