ERROR(BC_NOMEM);
}
- tvd->name = (char *)malloc(strlen(entries[e].name) + 10);
+ tvd->name = malloc(strlen(entries[e].name) + 10);
if (!(tvd->name)) {
afs_com_err(whoami, BC_NOMEM, NULL);
free(tvd);
return (BC_NOMEM);
}
- tvd->name = (char *)malloc(strlen(entry.name) + 10);
+ tvd->name = malloc(strlen(entry.name) + 10);
if (!(tvd->name)) {
afs_com_err(whoami, BC_NOMEM, NULL);
free(tvd);
return (NULL);
}
- string = (char *)malloc(length); /* allocate the string */
+ string = malloc(length); /* allocate the string */
if (!string) {
afs_com_err(whoami, BC_NOMEM, NULL);
return (NULL);
return BC_NOMEM;
}
- tvol->name = (char *)malloc(VOLSER_MAXVOLNAME + 1);
+ tvol->name = malloc(VOLSER_MAXVOLNAME + 1);
if (!tvol->name) {
afs_com_err(whoami, BC_NOMEM, NULL);
return BC_NOMEM;
if (as->parms[5].items) {
for (ti = as->parms[5].items; ti; ti = ti->next)
portCount++;
- ports = (afs_int32 *) malloc(portCount * sizeof(afs_int32));
+ ports = malloc(portCount * sizeof(afs_int32));
if (!ports) {
afs_com_err(whoami, BC_NOMEM, NULL);
return BC_NOMEM;
if (as->parms[2].items) {
for (ti = as->parms[2].items; ti; ti = ti->next)
portCount++;
- ports = (afs_int32 *) malloc(portCount * sizeof(afs_int32));
+ ports = malloc(portCount * sizeof(afs_int32));
if (!ports) {
afs_com_err(whoami, BC_NOMEM, NULL);
return BC_NOMEM;
/* Allocate a volumeDump structure and link it in */
tvol = calloc(1, sizeof(struct bc_volumeDump));
- tvol->name = (char *)malloc(VOLSER_MAXVOLNAME + 1);
+ tvol->name = malloc(VOLSER_MAXVOLNAME + 1);
if (!tvol->name) {
afs_com_err(whoami, BC_NOMEM, NULL);
return BC_NOMEM;
if (as->parms[2].items) {
for (ti = as->parms[2].items; ti; ti = ti->next)
portCount++;
- ports = (afs_int32 *) malloc(portCount * sizeof(afs_int32));
+ ports = malloc(portCount * sizeof(afs_int32));
if (!ports) {
afs_com_err(whoami, BC_NOMEM, NULL);
return BC_NOMEM;
/* get the port number, if one was specified */
if (as->parms[2].items) {
- portp = (afs_int32 *) malloc(sizeof(afs_int32));
+ portp = malloc(sizeof(afs_int32));
if (!portp) {
afs_com_err(whoami, BC_NOMEM, NULL);
return BC_NOMEM;
sprintf(statusPtr->taskName, "Scheduled Dump");
statusPtr->jobNumber = bc_jobNumber();
statusPtr->scheduledDump = atTime;
- statusPtr->cmdLine = (char *)malloc(length);
+ statusPtr->cmdLine = malloc(length);
if (!statusPtr->cmdLine) {
afs_com_err(whoami, BC_NOMEM, NULL);
return BC_NOMEM;
if (length == 0) /* no actual date string */
FAIL(1);
- dateString = (char *)malloc(length);
+ dateString = malloc(length);
if (dateString == 0)
FAIL(2);
time_t did;
int foundtape, c;
- dlevels = (struct dumpinfo *) malloc(num_dlevels * sizeof(*dlevels));
+ dlevels = malloc(num_dlevels * sizeof(*dlevels));
dumpTaskPtr = &bc_dumpTasks[aindex];
serverAll = HOSTADDR(&dumpTaskPtr->destServer);
partitionAll = dumpTaskPtr->destPartition;
- volumeEntries = (struct budb_volumeEntry *)
- malloc(MAXTAPESATONCE * sizeof(struct budb_volumeEntry));
+ volumeEntries = malloc(MAXTAPESATONCE * sizeof(struct budb_volumeEntry));
if (!volumeEntries) {
afs_com_err(whoami, BC_NOMEM, NULL);
ERROR(BC_NOMEM);
struct dumpinfo *tdl = dlevels;
num_dlevels += num_dlevels; /* double */
- dlevels = (struct dumpinfo *) malloc(num_dlevels * sizeof(*dlevels));
+ dlevels = malloc(num_dlevels * sizeof(*dlevels));
memcpy(dlevels, tdl, (num_dlevels/2) * sizeof(*dlevels));
free(tdl);
}
/* allocate a buffer */
bufferSize = 1024;
- charList.charListT_val = (char *)malloc(bufferSize);
+ charList.charListT_val = malloc(bufferSize);
if (charList.charListT_val == 0)
ERROR(BUDB_INTERNALERROR);
charList.charListT_len = bufferSize;
/* allocate a buffer */
bufferSize = 1024;
- charList.charListT_val = (char *)malloc(bufferSize);
+ charList.charListT_val = malloc(bufferSize);
if (charList.charListT_val == 0)
ERROR(BUDB_INTERNALERROR);
charList.charListT_len = bufferSize;
b = mht->blocks = calloc(1, mht->size);
for (i = 0; i < nb; i++) {
- b[i] = (struct memoryHTBlock *)malloc(sizeof(struct memoryHTBlock));
+ b[i] = malloc(sizeof(struct memoryHTBlock));
code = AllocBlock(ut, (struct block *)&b[i]->b, &b[i]->a);
if (code)
return code;
db_panic("non-zero length, but no table");
}
/* else ta is set from last time around loop */
- b[i] =
- (struct memoryHTBlock *)malloc(sizeof(struct memoryHTBlock));
+ b[i] = malloc(sizeof(struct memoryHTBlock));
b[i]->a = ta;
b[i]->valid = 0;
}
charListPtr->charListT_val = NULL;
} else {
charListPtr->charListT_len = transferSize;
- charListPtr->charListT_val = (char *)malloc(transferSize);
+ charListPtr->charListT_val = malloc(transferSize);
if (charListPtr->charListT_val == 0)
ABORT(BUDB_NOMEM);
}
no_xfer_abort:
charListPtr->charListT_len = 0;
- charListPtr->charListT_val = (char *)malloc(0);
+ charListPtr->charListT_val = malloc(0);
abort_exit:
if (ut)
ObtainWriteLock(&dumpSyncPtr->ds_lock);
}
- charListPtr->charListT_val = (char *)malloc(maxLength);
+ charListPtr->charListT_val = malloc(maxLength);
readSize =
read(dumpSyncPtr->pipeFid[0], charListPtr->charListT_val, maxLength);
if (list->nElements >= list->allocSize) {
if (list->elements == 0) {
size = 10;
- tmp = (char *)malloc(sizeof(dbadr) * size);
+ tmp = malloc(sizeof(dbadr) * size);
} else {
size = list->allocSize + 10;
tmp = realloc(list->elements, sizeof(dbadr) * size);
/* Record the dump just deleted */
if (dumps && (dumps->budb_dumpsList_len < BUDB_MAX_RETURN_LIST)) {
if (dumps->budb_dumpsList_len == 0)
- dumps->budb_dumpsList_val =
- (afs_int32 *) malloc(sizeof(afs_int32));
+ dumps->budb_dumpsList_val = malloc(sizeof(afs_int32));
else
dumps->budb_dumpsList_val =
realloc(dumps->budb_dumpsList_val,
count += 10;
if (count == 10) {
dumps->budb_dumpsList_val =
- (afs_int32 *) malloc(count *
- sizeof(afs_int32));
+ malloc(count * sizeof(afs_int32));
flags->budb_dumpsList_val =
- (afs_int32 *) malloc(count *
- sizeof(afs_int32));
+ malloc(count * sizeof(afs_int32));
} else {
dumps->budb_dumpsList_val =
realloc(dumps->budb_dumpsList_val,
LogDebug(3, "%d servers\n", nservers);
/* now can allocate the space for the server arguments */
- serverArgs = (char **)malloc((nservers + 2) * sizeof(char *));
+ serverArgs = malloc((nservers + 2) * sizeof(char *));
if (serverArgs == 0)
ERROR(-1);
for (i=0; i< ADSM_ENV_STRS; i++) {
if ( *envP == NULL ) { /* watch for NULL pointers */
/* Allocating memory for *envP.*/
- *envP = (char *) malloc(sizeof(char) * BSA_MAX_DESC +1);
+ *envP = malloc(sizeof(char) * BSA_MAX_DESC +1);
/* copy the content of envString[i] to *envP. */
strcpy(*envP,envString[i]);
int tried;
for (tried = 0; tried < 5; tried++) {
- entryPtr = (dlqlinkP) malloc(sizeof(dlqlinkT));
- entry = (char *)malloc(size);
+ entryPtr = malloc(sizeof(dlqlinkT));
+ entry = malloc(size);
if (entryPtr && entry)
break;
for (tried = 0; tried < 5; tried++) {
entryPtr = (dlqlinkP) malloc(sizeof(dlqlinkT));
- entry = (char *)malloc(size);
+ entry = malloc(size);
if (entryPtr && entry)
break;
/*
* Initialize the tape block buffers
*/
- tapeblock1 = (char *)malloc(3 * 16384);
+ tapeblock1 = malloc(3 * 16384);
if (tapeblock1 == NULL) {
printf("Failed to allocate I/O buffers.\n");
exit(1);
memset(volumeHeader, 0, sizeof(struct volumeHeader));
- block = (char *)malloc(2 * BUTM_BLOCKSIZE);
+ block = malloc(2 * BUTM_BLOCKSIZE);
if (!block)
return (TC_NOMEMORY);
buffer[0] = &block[sizeof(struct blockMark)];
/*initialize the dumpNode list */
InitNodeList(portOffset);
- deviceLatch =
- (struct deviceSyncNode *)(malloc(sizeof(struct deviceSyncNode)));
+ deviceLatch = malloc(sizeof(struct deviceSyncNode));
Lock_Init(&(deviceLatch->lock));
deviceLatch->flags = 0;
if (argc == 1) {
ts = calloc(1, sizeof(struct cmd_syndesc));
- ti = (struct cmd_item *)malloc(sizeof(struct cmd_item));
+ ti = malloc(sizeof(struct cmd_item));
ti->next = 0;
ti->data = "0";
ts->parms[0].items = ti;
- ti = (struct cmd_item *)malloc(sizeof(struct cmd_item));
+ ti = malloc(sizeof(struct cmd_item));
ti->next = 0;
ti->data = "0";
ts->parms[1].items = ti;
if (callPermitted(acid) == 0)
return (TC_NOTPERMITTED);
- ptr = (struct labelTapeIf *)malloc(sizeof(*ptr));
+ ptr = malloc(sizeof(*ptr));
if (!ptr)
ERROR_EXIT(TC_NOMEMORY);
memcpy(&ptr->label, label, sizeof(ptr->label));
CopyTapeSetDesc(&(newNode->tapeSetDesc), &tcdiPtr->tapeSet);
- newNode->dumps = (struct tc_dumpDesc *)
- malloc(sizeof(struct tc_dumpDesc) *
- tc_dumpArrayPtr->tc_dumpArray_len);
+ newNode->dumps = malloc(sizeof(struct tc_dumpDesc) *
+ tc_dumpArrayPtr->tc_dumpArray_len);
newNode->arraySize = tc_dumpArrayPtr->tc_dumpArray_len;
CopyDumpDesc(newNode->dumps, tc_dumpArrayPtr);
/* this creates a node in list, alots an id for it and prepares it for locking */
CreateNode(&newNode);
- newNode->restores = (struct tc_restoreDesc *)
- malloc(sizeof(struct tc_restoreDesc) *
- arestores->tc_restoreArray_len);
+ newNode->restores = malloc(sizeof(struct tc_restoreDesc) *
+ arestores->tc_restoreArray_len);
newNode->arraySize = arestores->tc_restoreArray_len;
CopyRestoreDesc(newNode->restores, arestores);
*taskID = newNode->taskID;
*taskId = allocTaskId();
- ptr = (struct saveDbIf *)malloc(sizeof(struct saveDbIf));
+ ptr = malloc(sizeof(struct saveDbIf));
if (!ptr)
ERROR_EXIT(TC_NOMEMORY);
ptr->archiveTime = archiveTime;
*taskId = allocTaskId();
- ptr = (struct scanTapeIf *)malloc(sizeof(*ptr));
+ ptr = malloc(sizeof(*ptr));
if (!ptr)
ERROR_EXIT(TC_NOMEMORY);
ptr->addDbFlag = addDbFlag;
if (callPermitted(acid) == 0)
return (TC_NOTPERMITTED);
- ptr = (struct deleteDumpIf *)malloc(sizeof(*ptr));
+ ptr = malloc(sizeof(*ptr));
if (!ptr)
ERROR_EXIT(TC_NOMEMORY);
charList.charListT_val = 0;
charList.charListT_len = 0;
blockSize = BUTM_BLKSIZE;
- writeBlock = (char *)malloc(BUTM_BLOCKSIZE);
+ writeBlock = malloc(BUTM_BLOCKSIZE);
if (!writeBlock)
ERROR_EXIT(TC_NOMEMORY);
udbClientTextP ctPtr = 0;
afs_int32 textType;
- ctPtr = (udbClientTextP) malloc(sizeof(*ctPtr));
+ ctPtr = malloc(sizeof(*ctPtr));
if (!ctPtr)
ERROR_EXIT(TC_NOMEMORY);
/* allocate buffer for text */
readBlockSize = BUTM_BLKSIZE;
- readBuffer = (char *)malloc(readBlockSize);
+ readBuffer = malloc(readBlockSize);
if (!readBuffer)
ERROR_EXIT(TC_NOMEMORY);
ERROR_EXIT(TC_ABORTEDBYREQUEST);
if (!tapeReadBuffer) {
- tapeReadBuffer = (char *)malloc(BUTM_BLOCKSIZE);
+ tapeReadBuffer = malloc(BUTM_BLOCKSIZE);
if (!tapeReadBuffer)
ERROR_EXIT(TC_NOMEMORY);
}
strcpy(ttapeSet.format, "tapeName%u");
strcpy(ttapeSet.tapeServer, "diskTapes");
tdumps.tc_dumpArray_val =
- (struct tc_dumpDesc
- *)(malloc(tdumps.tc_dumpArray_len * sizeof(struct tc_dumpDesc)));
+ malloc(tdumps.tc_dumpArray_len * sizeof(struct tc_dumpDesc));
ptr = tdumps.tc_dumpArray_val;
for (i = 0; i < tdumps.tc_dumpArray_len; i++) {
fscanf(fp, "%s\n", ptr->name);
strcpy(tdumpSetName, "Test");
fp = fopen("restoreScr", "r");
fscanf(fp, "%u\n", &trestores.tc_restoreArray_len);
- trestores.tc_restoreArray_val =
- (struct tc_restoreDesc *)malloc(trestores.tc_restoreArray_len *
- sizeof(struct tc_restoreDesc));
+ trestores.tc_restoreArray_val
+ = malloc(trestores.tc_restoreArray_len *
+ sizeof(struct tc_restoreDesc));
ptr = trestores.tc_restoreArray_val;
for (i = 0; i < trestores.tc_restoreArray_len; i++) {
fscanf(fp, "%s\n", ptr->oldName);
(void)PrepareAccess(fid); /* for NT */
- p = (struct progress *)malloc(sizeof(*p));
+ p = malloc(sizeof(*p));
info->tmRock = (char *)p;
p->fid = fid;
p->mountId = config.mountId = time(0);
if (argc < 2)
goto usage;
- files = (char **)malloc(argc * sizeof(char *));
+ files = malloc(argc * sizeof(char *));
nFiles = 0;
for (i = 1; i < argc; i++) {
if (argv[i][0] == '-') {
int i, past, code;
struct timeval tp;
- bufferBlock = (struct BufferBlock *)malloc(sizeof(struct BufferBlock));
+ bufferBlock = malloc(sizeof(struct BufferBlock));
info.structVersion = BUTM_MAJORVERSION;
if (code = butm_file_Instantiate(&info, tip->tc_Infop)) {