afs_com_err(whoami, code, "prompting for %s", p + 1);
return code;
}
- ip = (struct cmd_item *)malloc(sizeof(struct cmd_item));
+ ip = malloc(sizeof(struct cmd_item));
ip->data = strdup(password);
ip->next = 0;
as->parms[i].items = ip;
if (len < 0 || len > MAXBS)
return FALSE;
if (!abbs->SeqBody)
- abbs->SeqBody = (char *)malloc(len);
+ abbs->SeqBody = malloc(len);
abbs->SeqLen = len;
xdr_opaque(x, abbs->SeqBody, len);
return TRUE;
|| (len > MAXBS) || (len > maxLen))
return FALSE;
if (!abbs->SeqBody)
- abbs->SeqBody = (char *)malloc(maxLen);
+ abbs->SeqBody = malloc(maxLen);
abbs->MaxSeqLen = maxLen;
abbs->SeqLen = len;
if (!xdr_opaque(x, abbs->SeqBody, len))
Lock_Init(&keycache_lock);
maxCachedKeys = 10;
- keyCache =
- (struct cachedKey *)malloc(maxCachedKeys * sizeof(struct cachedKey));
+ keyCache = malloc(maxCachedKeys * sizeof(struct cachedKey));
keyCacheVersion = 0;
if (initFlags & 4) {
maxKeyLifetime = 90;
sscanf(astr, "%d", &nminus);
SkipLine(astr);
- ta = (struct Acl *)malloc(sizeof(struct Acl));
+ ta = malloc(sizeof(struct Acl));
ta->nplus = nplus;
last = 0;
for (i = 0; i < nplus; i++) {
sscanf(astr, "%100s %d", tname, &trights);
SkipLine(astr);
- tl = (struct AclEntry *)malloc(sizeof(struct AclEntry));
+ tl = malloc(sizeof(struct AclEntry));
if (!first)
first = tl;
strcpy(tl->name, tname);
i = 0;
while (environ[i] != NULL)
i++;
- envnew = (char **)malloc(sizeof(char *) * (i + 1));
+ envnew = malloc(sizeof(char *) * (i + 1));
for (; i >= 0; i--)
envnew[i] = environ[i];
environ = envnew;
sscanf(astr, "%d", &nminus);
astr = SkipLine(astr);
- ta = (struct Acl *)malloc(sizeof(struct Acl));
+ ta = malloc(sizeof(struct Acl));
ta->nplus = nplus;
ta->nminus = nminus;
for (i = 0; i < nplus; i++) {
sscanf(astr, "%100s %d", tname, &trights);
astr = SkipLine(astr);
- tl = (struct AclEntry *)malloc(sizeof(struct AclEntry));
+ tl = malloc(sizeof(struct AclEntry));
if (!first)
first = tl;
strcpy(tl->name, tname);
for (i = 0; i < nminus; i++) {
sscanf(astr, "%100s %d", tname, &trights);
astr = SkipLine(astr);
- tl = (struct AclEntry *)malloc(sizeof(struct AclEntry));
+ tl = malloc(sizeof(struct AclEntry));
if (!first)
first = tl;
strcpy(tl->name, tname);
}
al->nplus -= PruneList(&al->pluslist);
- tlist = (struct AclEntry *)malloc(sizeof(struct AclEntry));
+ tlist = malloc(sizeof(struct AclEntry));
tlist->rights = 9;
strcpy(tlist->name, tester);
tlist->next = al->pluslist;
if (map->m_page == page)
break;
if (!map) {
- map = (struct bitmap *)malloc(sizeof *map);
+ map = malloc(sizeof *map);
if (!map) {
#ifdef PRINT_MAP_ERROR
printf("No memory!\n");
#endif
map = MAP(parm);
for (mpp = &result; (*mpp = 0), map; map = map->m_next) {
- *mpp = (struct bitmap *)malloc(sizeof **mpp);
+ *mpp = malloc(sizeof **mpp);
if (!*mpp) {
#ifdef MAP_DEBUG
if (Mflag)
if (map->m_page == page)
break;
if (!map) {
- map = (struct bitmap *)malloc(sizeof *map);
+ map = malloc(sizeof *map);
if (!map) {
#ifdef PRINT_MAP_ERROR
printf("No memory!\n");
code = CreateEntry(0, name, &id, 1 /*idflag */ ,
flags & PRGRP, oid, cid);
if (code == PRBADNAM) {
- u = (struct usr_list *)malloc(sizeof(struct usr_list));
+ u = malloc(sizeof(struct usr_list));
u->next = usr_head;
u->uid = id;
strcpy(u->name, name);
i = grp_count++ % 1024;
if (i == 0) {
- g = (struct grp_list *)malloc(sizeof(struct grp_list));
+ g = malloc(sizeof(struct grp_list));
g->next = grp_head;
grp_head = g;
}
last = he;
he = he->next;
}
- he = (struct hash_entry *)malloc(sizeof(struct hash_entry));
+ he = malloc(sizeof(struct hash_entry));
if (he == 0) {
fprintf(stderr, "pt_util: No Memory for internal hash table.\n");
exit(1);
if (CodeOk(code))
afs_com_err(whoami, code, "on %s %d %d", op, id, gid);
} else if (!strcmp(op, "iton")) {
- lid.idlist_val = (afs_int32 *) malloc(20 * sizeof(afs_int32));
+ lid.idlist_val = malloc(20 * sizeof(afs_int32));
ptr = lid.idlist_val;
lid.idlist_len = 0;
foo = line;
lid.idlist_val = 0;
lid.idlist_len = 0;
} else if (!strcmp(op, "ntoi")) {
- lnames.namelist_val =
- (prname *) malloc(PR_MAXLIST * PR_MAXNAMELEN);
+ lnames.namelist_val = malloc(PR_MAXLIST * PR_MAXNAMELEN);
lnames.namelist_len = 0;
foo = line;
skip(&foo);
if (size < 0)
return PRTOOMANY;
- aid->idlist_val = (afs_int32 *) malloc(size * sizeof(afs_int32));
+ aid->idlist_val = malloc(size * sizeof(afs_int32));
if (!aid->idlist_val)
return PRNOMEM;
return 0;
if (size < 0)
return PRTOOMANY;
- aname->namelist_val = (prname *) malloc(size * PR_MAXNAMELEN);
+ aname->namelist_val = malloc(size * PR_MAXNAMELEN);
aname->namelist_len = 0;
if (aname->namelist_val == 0)
return PRNOMEM;
if (bulkentries->prentries_val == 0) {
bulkentries->prentries_len = 0;
- bulkentries->prentries_val =
- (struct prlistentries *)malloc(PR_MAXENTRIES *
- sizeof(struct prentry));
+ bulkentries->prentries_val = malloc(PR_MAXENTRIES *
+ sizeof(struct prentry));
if (!bulkentries->prentries_val) {
return (PRNOMEM);
}
perror(as->parms[0].items->data);
return errno;
}
- sp = (struct sourcestack *)malloc(sizeof *sp);
+ sp = malloc(sizeof *sp);
if (!sp) {
return errno ? errno : ENOMEM;
} else {
n = 0; /* count names */
for (i = as->parms[0].items; i; i = i->next)
n++;
- nl->namelist_val = (prname *) malloc(n * PR_MAXNAMELEN);
+ nl->namelist_val = malloc(n * PR_MAXNAMELEN);
nl->namelist_len = n;
n = 0;
for (i = as->parms[0].items; i; i = i->next)
n = 0;
for (i = as->parms[1].items; i; i = i->next)
n++;
- lids->idlist_val = (afs_int32 *) malloc(n * sizeof(afs_int32));
+ lids->idlist_val = malloc(n * sizeof(afs_int32));
lids->idlist_len = n;
n = 0;
for (i = as->parms[1].items; i; i = i->next) {
lnames->namelist_len = 0;
}
for (i = as->parms[0].items; i; i = i->next) {
- tnames.namelist_val = (prname *) malloc(PR_MAXNAMELEN);
+ tnames.namelist_val = malloc(PR_MAXNAMELEN);
strncpy(tnames.namelist_val[0], i->data, PR_MAXNAMELEN);
tnames.namelist_len = 1;
tids.idlist_len = 0;
return PRBADARG;
lids.idlist_len = 2;
- lids.idlist_val = (afs_int32 *) malloc(sizeof(afs_int32) * 2);
+ lids.idlist_val = malloc(sizeof(afs_int32) * 2);
lnames.namelist_len = 0;
lnames.namelist_val = 0;
}
/* Insert this id but return not found. */
- newChain = (struct idchain *)malloc(sizeof(struct idchain));
+ newChain = malloc(sizeof(struct idchain));
if (!newChain) {
return ENOMEM;
} else {
}
alist->idlist_len = entries;
- alist->idlist_val = (afs_int32 *) malloc(sizeof(afs_int32) * entries);
+ alist->idlist_val = malloc(sizeof(afs_int32) * entries);
if (!alist->idlist_val) {
return ENOMEM;
}
if (code) {
return code;
}
- stack = (afs_int32 *) malloc(sizeof(afs_int32) * maxstack);
+ stack = malloc(sizeof(afs_int32) * maxstack);
if (!stack) {
code = ENOMEM;
goto done;
if (alist->prlist_val) {
tmp = realloc(alist->prlist_val, count * sizeof(afs_int32));
} else {
- tmp = (char *)malloc(count * sizeof(afs_int32));
+ tmp = malloc(count * sizeof(afs_int32));
}
if (!tmp)
return (PRNOMEM);
verbose = 1;
else {
if (!strcmp(argv[i], "-c")) {
- cellname = (char *)malloc(100);
+ cellname = malloc(100);
strncpy(cellname, argv[++i], 100);
} else
strncpy(buf, argv[i], 150);
verbose = 1;
else {
if (!strcmp(argv[i], "-c")) {
- cellname = (char *)malloc(100);
+ cellname = malloc(100);
strncpy(cellname, argv[++i], 100);
} else
strncpy(buf, argv[i], 150);
printf("Checking for %d %sused ids starting at %d.\n", number,
(unused ? "un" : ""), startId);
#define NUM 100
- lids.idlist_val = (afs_int32 *) malloc(sizeof(afs_int32) * NUM);
+ lids.idlist_val = malloc(sizeof(afs_int32) * NUM);
lnames.namelist_len = 0;
lnames.namelist_val = 0;
while (number) {
nCleaned = 0;
ownerUser = lastGroup = 0;
- groupOwners = (afs_int32 *) malloc(number * sizeof(afs_int32));
+ groupOwners = malloc(number * sizeof(afs_int32));
nUsers = nGroups = nAdds = nRems = nUDels = nGDels = 0;
while ((nFilled < number) || (nCleaned < number)) {
/* check the membership list of all users for correctness */
printf("Starting check of memberships\n");
- glist = (afs_int32 *) malloc(number * sizeof(afs_int32));
+ glist = malloc(number * sizeof(afs_int32));
for (u = 0; u < number; u++) {
afs_int32 ui = users[u];
if (ui) {
{
struct ubik_trunc *tt;
if (!freeTruncList) {
- freeTruncList =
- (struct ubik_trunc *)malloc(sizeof(struct ubik_trunc));
+ freeTruncList = malloc(sizeof(struct ubik_trunc));
freeTruncList->next = (struct ubik_trunc *)0;
}
tt = freeTruncList;
initialize_U_error_table();
- tdb = (struct ubik_dbase *)malloc(sizeof(struct ubik_dbase));
+ tdb = malloc(sizeof(struct ubik_dbase));
tdb->pathName = strdup(pathName);
tdb->activeTrans = (struct ubik_trans *)0;
memset(&tdb->version, 0, sizeof(struct ubik_version));
if (!transPtr->iovec_info.iovec_wrt_val) {
transPtr->iovec_info.iovec_wrt_len = 0;
transPtr->iovec_info.iovec_wrt_val =
- (struct ubik_iovec *)malloc(IOVEC_MAXWRT *
- sizeof(struct ubik_iovec));
+ malloc(IOVEC_MAXWRT * sizeof(struct ubik_iovec));
transPtr->iovec_data.iovec_buf_len = 0;
- transPtr->iovec_data.iovec_buf_val = (char *)malloc(IOVEC_MAXBUF);
+ transPtr->iovec_data.iovec_buf_val = malloc(IOVEC_MAXBUF);
if (!transPtr->iovec_info.iovec_wrt_val
|| !transPtr->iovec_data.iovec_buf_val) {
if (transPtr->iovec_info.iovec_wrt_val)
return UMUTEXDESTROY;
#endif
} else {
- tc = (struct ubik_client *)malloc(sizeof(struct ubik_client));
+ tc = malloc(sizeof(struct ubik_client));
}
if (tc == NULL)
return UNOMEM;
perror("seek MH block");
exit(1);
}
- base[0] = (struct extentaddr *)malloc(VL_ADDREXTBLK_SIZE);
+ base[0] = malloc(VL_ADDREXTBLK_SIZE);
if (!base[0]) {
perror("malloc1");
exit(1);
perror("seek MH block");
exit(1);
}
- base[j] = (struct extentaddr *)malloc(VL_ADDREXTBLK_SIZE);
+ base[j] = malloc(VL_ADDREXTBLK_SIZE);
if (!base[j]) {
perror("malloc1");
exit(1);
afs_int32 index, count, num = 0, num1 = 0, next_index;
struct Vlent *vl1;
- VL = SVL =
- (struct Vlent *)malloc(ALLOCNT * sizeof(struct Vlent));
+ VL = SVL = malloc(ALLOCNT * sizeof(struct Vlent));
if (VL == NULL) {
printf("Can't allocate memory...\n");
exit(1);
0, num31 = 0, num4 = 0, num41 = 0, next_index;
struct vldbentry tentry;
- VL = SVL =
- (struct Vlent *)malloc(ALLOCNT * sizeof(struct Vlent));
+ VL = SVL = malloc(ALLOCNT * sizeof(struct Vlent));
if (VL == NULL) {
printf("Can't allocate memory...\n");
exit(1);
0;
struct vldbentry tentry;
- VL = SVL =
- (struct Vlent *)malloc(ALLOCNT * sizeof(struct Vlent));
+ VL = SVL = malloc(ALLOCNT * sizeof(struct Vlent));
if (VL == NULL) {
printf("Can't allocate memory...\n");
exit(1);
printf("Illegal # entries = %d\n", nargs);
continue;
}
- addrp = (afs_uint32 *) malloc(20 * 4);
+ addrp = malloc(20 * 4);
addrs.bulkaddrs_val = addrp;
addrs.bulkaddrs_len = nargs;
while (nargs > 0) {
return code;
allocCount = VLDBALLOCCOUNT;
Vldbentry = VldbentryFirst = vldbentries->bulkentries_val =
- (vldbentry *) malloc(allocCount * sizeof(vldbentry));
+ malloc(allocCount * sizeof(vldbentry));
if (Vldbentry == NULL) {
code = VL_NOMEM;
goto abort;
return code;
allocCount = VLDBALLOCCOUNT;
Vldbentry = VldbentryFirst = vldbentries->nbulkentries_val =
- (nvldbentry *) malloc(allocCount * sizeof(nvldbentry));
+ malloc(allocCount * sizeof(nvldbentry));
if (Vldbentry == NULL) {
code = VL_NOMEM;
goto abort;
return code;
Vldbentry = VldbentryFirst = vldbentries->nbulkentries_val =
- (nvldbentry *) malloc(maxCount * sizeof(nvldbentry));
+ malloc(maxCount * sizeof(nvldbentry));
if (Vldbentry == NULL) {
countAbort(this_op);
ubik_AbortTrans(ctx.trans);
goto abort;
}
- vllist = (single_vldbentry *) malloc(sizeof(single_vldbentry));
+ vllist = malloc(sizeof(single_vldbentry));
if (vllist == NULL) {
code = VL_NOMEM;
goto abort;
continue;
}
- vllist = (single_vldbentry *) malloc(sizeof(single_vldbentry));
+ vllist = malloc(sizeof(single_vldbentry));
if (vllist == NULL) {
code = VL_NOMEM;
goto abort;
goto abort;
}
- vllist = (single_nvldbentry *) malloc(sizeof(single_nvldbentry));
+ vllist = malloc(sizeof(single_nvldbentry));
if (vllist == NULL) {
code = VL_NOMEM;
goto abort;
continue;
}
- vllist = (single_nvldbentry *) malloc(sizeof(single_nvldbentry));
+ vllist = malloc(sizeof(single_nvldbentry));
if (vllist == NULL) {
code = VL_NOMEM;
goto abort;
VLog(5, ("GetAddrs\n"));
addrsp->bulkaddrs_val = taddrp =
- (afs_uint32 *) malloc(sizeof(afs_int32) * (MAXSERVERID + 1));
+ malloc(sizeof(afs_int32) * (MAXSERVERID + 1));
nservers = *nentries = addrsp->bulkaddrs_len = 0;
if (!taddrp) {
goto abort;
}
addrsp->bulkaddrs_val = taddrp =
- (afs_uint32 *) malloc(sizeof(afs_int32) * (MAXSERVERID + 1));
+ malloc(sizeof(afs_int32) * (MAXSERVERID + 1));
nservers = *nentries = addrsp->bulkaddrs_len = 0;
if (!taddrp) {
code = VL_NOMEM;
/* Read the first extension block */
if (!rd_ex_addr[0]) {
- rd_ex_addr[0] = (struct extentaddr *)malloc(VL_ADDREXTBLK_SIZE);
+ rd_ex_addr[0] = malloc(VL_ADDREXTBLK_SIZE);
if (!rd_ex_addr[0])
ERROR_EXIT(VL_NOMEM);
}
/* Read the continuation block */
if (!rd_ex_addr[i]) {
- rd_ex_addr[i] = (struct extentaddr *)malloc(VL_ADDREXTBLK_SIZE);
+ rd_ex_addr[i] = malloc(VL_ADDREXTBLK_SIZE);
if (!rd_ex_addr[i])
ERROR_EXIT(VL_NOMEM);
}
if (!ctx->ex_addr[0] || !ctx->ex_addr[0]->ex_contaddrs[base]) {
/* Create a new extension block */
if (!ctx->ex_addr[base]) {
- ctx->ex_addr[base] = (struct extentaddr *)malloc(VL_ADDREXTBLK_SIZE);
+ ctx->ex_addr[base] = malloc(VL_ADDREXTBLK_SIZE);
if (!ctx->ex_addr[base])
ERROR_EXIT(VL_NOMEM);
}