mirror of
https://git.openafs.org/openafs.git
synced 2025-01-21 00:10:15 +00:00
backup: 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's unecessary noise. Change-Id: I6a878d53007e27179c11d8f745b09dacade4c83d Reviewed-on: http://gerrit.openafs.org/7460 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@dementix.org>
This commit is contained in:
parent
0cf3c58d80
commit
ca48be9161
@ -313,7 +313,7 @@ EvalVolumeSet2(struct bc_config *aconfig,
|
|||||||
ERROR(BC_NOMEM);
|
ERROR(BC_NOMEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
tvd->name = (char *)malloc(strlen(entries[e].name) + 10);
|
tvd->name = malloc(strlen(entries[e].name) + 10);
|
||||||
if (!(tvd->name)) {
|
if (!(tvd->name)) {
|
||||||
afs_com_err(whoami, BC_NOMEM, NULL);
|
afs_com_err(whoami, BC_NOMEM, NULL);
|
||||||
free(tvd);
|
free(tvd);
|
||||||
@ -581,7 +581,7 @@ EvalVolumeSet1(struct bc_config *aconfig,
|
|||||||
return (BC_NOMEM);
|
return (BC_NOMEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
tvd->name = (char *)malloc(strlen(entry.name) + 10);
|
tvd->name = malloc(strlen(entry.name) + 10);
|
||||||
if (!(tvd->name)) {
|
if (!(tvd->name)) {
|
||||||
afs_com_err(whoami, BC_NOMEM, NULL);
|
afs_com_err(whoami, BC_NOMEM, NULL);
|
||||||
free(tvd);
|
free(tvd);
|
||||||
@ -759,7 +759,7 @@ concatParams(struct cmd_item *itemPtr)
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
string = (char *)malloc(length); /* allocate the string */
|
string = malloc(length); /* allocate the string */
|
||||||
if (!string) {
|
if (!string) {
|
||||||
afs_com_err(whoami, BC_NOMEM, NULL);
|
afs_com_err(whoami, BC_NOMEM, NULL);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
@ -1186,7 +1186,7 @@ bc_VolRestoreCmd(struct cmd_syndesc *as, void *arock)
|
|||||||
return BC_NOMEM;
|
return BC_NOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
tvol->name = (char *)malloc(VOLSER_MAXVOLNAME + 1);
|
tvol->name = malloc(VOLSER_MAXVOLNAME + 1);
|
||||||
if (!tvol->name) {
|
if (!tvol->name) {
|
||||||
afs_com_err(whoami, BC_NOMEM, NULL);
|
afs_com_err(whoami, BC_NOMEM, NULL);
|
||||||
return BC_NOMEM;
|
return BC_NOMEM;
|
||||||
@ -1226,7 +1226,7 @@ bc_VolRestoreCmd(struct cmd_syndesc *as, void *arock)
|
|||||||
if (as->parms[5].items) {
|
if (as->parms[5].items) {
|
||||||
for (ti = as->parms[5].items; ti; ti = ti->next)
|
for (ti = as->parms[5].items; ti; ti = ti->next)
|
||||||
portCount++;
|
portCount++;
|
||||||
ports = (afs_int32 *) malloc(portCount * sizeof(afs_int32));
|
ports = malloc(portCount * sizeof(afs_int32));
|
||||||
if (!ports) {
|
if (!ports) {
|
||||||
afs_com_err(whoami, BC_NOMEM, NULL);
|
afs_com_err(whoami, BC_NOMEM, NULL);
|
||||||
return BC_NOMEM;
|
return BC_NOMEM;
|
||||||
@ -1356,7 +1356,7 @@ bc_DiskRestoreCmd(struct cmd_syndesc *as, void *arock)
|
|||||||
if (as->parms[2].items) {
|
if (as->parms[2].items) {
|
||||||
for (ti = as->parms[2].items; ti; ti = ti->next)
|
for (ti = as->parms[2].items; ti; ti = ti->next)
|
||||||
portCount++;
|
portCount++;
|
||||||
ports = (afs_int32 *) malloc(portCount * sizeof(afs_int32));
|
ports = malloc(portCount * sizeof(afs_int32));
|
||||||
if (!ports) {
|
if (!ports) {
|
||||||
afs_com_err(whoami, BC_NOMEM, NULL);
|
afs_com_err(whoami, BC_NOMEM, NULL);
|
||||||
return BC_NOMEM;
|
return BC_NOMEM;
|
||||||
@ -1525,7 +1525,7 @@ bc_VolsetRestoreCmd(struct cmd_syndesc *as, void *arock)
|
|||||||
/* Allocate a volumeDump structure and link it in */
|
/* Allocate a volumeDump structure and link it in */
|
||||||
tvol = calloc(1, sizeof(struct bc_volumeDump));
|
tvol = calloc(1, sizeof(struct bc_volumeDump));
|
||||||
|
|
||||||
tvol->name = (char *)malloc(VOLSER_MAXVOLNAME + 1);
|
tvol->name = malloc(VOLSER_MAXVOLNAME + 1);
|
||||||
if (!tvol->name) {
|
if (!tvol->name) {
|
||||||
afs_com_err(whoami, BC_NOMEM, NULL);
|
afs_com_err(whoami, BC_NOMEM, NULL);
|
||||||
return BC_NOMEM;
|
return BC_NOMEM;
|
||||||
@ -1551,7 +1551,7 @@ bc_VolsetRestoreCmd(struct cmd_syndesc *as, void *arock)
|
|||||||
if (as->parms[2].items) {
|
if (as->parms[2].items) {
|
||||||
for (ti = as->parms[2].items; ti; ti = ti->next)
|
for (ti = as->parms[2].items; ti; ti = ti->next)
|
||||||
portCount++;
|
portCount++;
|
||||||
ports = (afs_int32 *) malloc(portCount * sizeof(afs_int32));
|
ports = malloc(portCount * sizeof(afs_int32));
|
||||||
if (!ports) {
|
if (!ports) {
|
||||||
afs_com_err(whoami, BC_NOMEM, NULL);
|
afs_com_err(whoami, BC_NOMEM, NULL);
|
||||||
return BC_NOMEM;
|
return BC_NOMEM;
|
||||||
@ -1706,7 +1706,7 @@ bc_DumpCmd(struct cmd_syndesc *as, void *arock)
|
|||||||
|
|
||||||
/* get the port number, if one was specified */
|
/* get the port number, if one was specified */
|
||||||
if (as->parms[2].items) {
|
if (as->parms[2].items) {
|
||||||
portp = (afs_int32 *) malloc(sizeof(afs_int32));
|
portp = malloc(sizeof(afs_int32));
|
||||||
if (!portp) {
|
if (!portp) {
|
||||||
afs_com_err(whoami, BC_NOMEM, NULL);
|
afs_com_err(whoami, BC_NOMEM, NULL);
|
||||||
return BC_NOMEM;
|
return BC_NOMEM;
|
||||||
@ -1787,7 +1787,7 @@ bc_DumpCmd(struct cmd_syndesc *as, void *arock)
|
|||||||
sprintf(statusPtr->taskName, "Scheduled Dump");
|
sprintf(statusPtr->taskName, "Scheduled Dump");
|
||||||
statusPtr->jobNumber = bc_jobNumber();
|
statusPtr->jobNumber = bc_jobNumber();
|
||||||
statusPtr->scheduledDump = atTime;
|
statusPtr->scheduledDump = atTime;
|
||||||
statusPtr->cmdLine = (char *)malloc(length);
|
statusPtr->cmdLine = malloc(length);
|
||||||
if (!statusPtr->cmdLine) {
|
if (!statusPtr->cmdLine) {
|
||||||
afs_com_err(whoami, BC_NOMEM, NULL);
|
afs_com_err(whoami, BC_NOMEM, NULL);
|
||||||
return BC_NOMEM;
|
return BC_NOMEM;
|
||||||
|
@ -418,7 +418,7 @@ bc_ParseExpiration(struct cmd_parmdesc *paramPtr, afs_int32 *expType,
|
|||||||
if (length == 0) /* no actual date string */
|
if (length == 0) /* no actual date string */
|
||||||
FAIL(1);
|
FAIL(1);
|
||||||
|
|
||||||
dateString = (char *)malloc(length);
|
dateString = malloc(length);
|
||||||
if (dateString == 0)
|
if (dateString == 0)
|
||||||
FAIL(2);
|
FAIL(2);
|
||||||
|
|
||||||
|
@ -185,14 +185,13 @@ bc_Restorer(afs_int32 aindex)
|
|||||||
time_t did;
|
time_t did;
|
||||||
int foundtape, c;
|
int foundtape, c;
|
||||||
|
|
||||||
dlevels = (struct dumpinfo *) malloc(num_dlevels * sizeof(*dlevels));
|
dlevels = malloc(num_dlevels * sizeof(*dlevels));
|
||||||
|
|
||||||
dumpTaskPtr = &bc_dumpTasks[aindex];
|
dumpTaskPtr = &bc_dumpTasks[aindex];
|
||||||
serverAll = HOSTADDR(&dumpTaskPtr->destServer);
|
serverAll = HOSTADDR(&dumpTaskPtr->destServer);
|
||||||
partitionAll = dumpTaskPtr->destPartition;
|
partitionAll = dumpTaskPtr->destPartition;
|
||||||
|
|
||||||
volumeEntries = (struct budb_volumeEntry *)
|
volumeEntries = malloc(MAXTAPESATONCE * sizeof(struct budb_volumeEntry));
|
||||||
malloc(MAXTAPESATONCE * sizeof(struct budb_volumeEntry));
|
|
||||||
if (!volumeEntries) {
|
if (!volumeEntries) {
|
||||||
afs_com_err(whoami, BC_NOMEM, NULL);
|
afs_com_err(whoami, BC_NOMEM, NULL);
|
||||||
ERROR(BC_NOMEM);
|
ERROR(BC_NOMEM);
|
||||||
@ -332,7 +331,7 @@ bc_Restorer(afs_int32 aindex)
|
|||||||
struct dumpinfo *tdl = dlevels;
|
struct dumpinfo *tdl = dlevels;
|
||||||
|
|
||||||
num_dlevels += num_dlevels; /* double */
|
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));
|
memcpy(dlevels, tdl, (num_dlevels/2) * sizeof(*dlevels));
|
||||||
free(tdl);
|
free(tdl);
|
||||||
}
|
}
|
||||||
|
@ -489,7 +489,7 @@ bcdb_GetTextFile(udbClientTextP ctPtr)
|
|||||||
|
|
||||||
/* allocate a buffer */
|
/* allocate a buffer */
|
||||||
bufferSize = 1024;
|
bufferSize = 1024;
|
||||||
charList.charListT_val = (char *)malloc(bufferSize);
|
charList.charListT_val = malloc(bufferSize);
|
||||||
if (charList.charListT_val == 0)
|
if (charList.charListT_val == 0)
|
||||||
ERROR(BUDB_INTERNALERROR);
|
ERROR(BUDB_INTERNALERROR);
|
||||||
charList.charListT_len = bufferSize;
|
charList.charListT_len = bufferSize;
|
||||||
@ -558,7 +558,7 @@ bcdb_SaveTextFile(udbClientTextP ctPtr)
|
|||||||
|
|
||||||
/* allocate a buffer */
|
/* allocate a buffer */
|
||||||
bufferSize = 1024;
|
bufferSize = 1024;
|
||||||
charList.charListT_val = (char *)malloc(bufferSize);
|
charList.charListT_val = malloc(bufferSize);
|
||||||
if (charList.charListT_val == 0)
|
if (charList.charListT_val == 0)
|
||||||
ERROR(BUDB_INTERNALERROR);
|
ERROR(BUDB_INTERNALERROR);
|
||||||
charList.charListT_len = bufferSize;
|
charList.charListT_len = bufferSize;
|
||||||
|
@ -175,7 +175,7 @@ ht_AllocTable(struct ubik_trans *ut, struct memoryHashTable *mht)
|
|||||||
b = mht->blocks = calloc(1, mht->size);
|
b = mht->blocks = calloc(1, mht->size);
|
||||||
|
|
||||||
for (i = 0; i < nb; i++) {
|
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);
|
code = AllocBlock(ut, (struct block *)&b[i]->b, &b[i]->a);
|
||||||
if (code)
|
if (code)
|
||||||
return code;
|
return code;
|
||||||
@ -302,8 +302,7 @@ ht_GetTableBlock(struct ubik_trans *ut, struct memoryHashTable *mht,
|
|||||||
db_panic("non-zero length, but no table");
|
db_panic("non-zero length, but no table");
|
||||||
}
|
}
|
||||||
/* else ta is set from last time around loop */
|
/* else ta is set from last time around loop */
|
||||||
b[i] =
|
b[i] = malloc(sizeof(struct memoryHTBlock));
|
||||||
(struct memoryHTBlock *)malloc(sizeof(struct memoryHTBlock));
|
|
||||||
b[i]->a = ta;
|
b[i]->a = ta;
|
||||||
b[i]->valid = 0;
|
b[i]->valid = 0;
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ GetText(struct rx_call *call, afs_uint32 lockHandle, afs_int32 textType,
|
|||||||
charListPtr->charListT_val = NULL;
|
charListPtr->charListT_val = NULL;
|
||||||
} else {
|
} else {
|
||||||
charListPtr->charListT_len = transferSize;
|
charListPtr->charListT_len = transferSize;
|
||||||
charListPtr->charListT_val = (char *)malloc(transferSize);
|
charListPtr->charListT_val = malloc(transferSize);
|
||||||
if (charListPtr->charListT_val == 0)
|
if (charListPtr->charListT_val == 0)
|
||||||
ABORT(BUDB_NOMEM);
|
ABORT(BUDB_NOMEM);
|
||||||
}
|
}
|
||||||
@ -177,7 +177,7 @@ GetText(struct rx_call *call, afs_uint32 lockHandle, afs_int32 textType,
|
|||||||
|
|
||||||
no_xfer_abort:
|
no_xfer_abort:
|
||||||
charListPtr->charListT_len = 0;
|
charListPtr->charListT_len = 0;
|
||||||
charListPtr->charListT_val = (char *)malloc(0);
|
charListPtr->charListT_val = malloc(0);
|
||||||
|
|
||||||
abort_exit:
|
abort_exit:
|
||||||
if (ut)
|
if (ut)
|
||||||
|
@ -219,7 +219,7 @@ DumpDB(struct rx_call *call,
|
|||||||
ObtainWriteLock(&dumpSyncPtr->ds_lock);
|
ObtainWriteLock(&dumpSyncPtr->ds_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
charListPtr->charListT_val = (char *)malloc(maxLength);
|
charListPtr->charListT_val = malloc(maxLength);
|
||||||
readSize =
|
readSize =
|
||||||
read(dumpSyncPtr->pipeFid[0], charListPtr->charListT_val, maxLength);
|
read(dumpSyncPtr->pipeFid[0], charListPtr->charListT_val, maxLength);
|
||||||
|
|
||||||
|
@ -365,7 +365,7 @@ AddToReturnList(struct returnList *list, dbadr a, afs_int32 *to_skipP)
|
|||||||
if (list->nElements >= list->allocSize) {
|
if (list->nElements >= list->allocSize) {
|
||||||
if (list->elements == 0) {
|
if (list->elements == 0) {
|
||||||
size = 10;
|
size = 10;
|
||||||
tmp = (char *)malloc(sizeof(dbadr) * size);
|
tmp = malloc(sizeof(dbadr) * size);
|
||||||
} else {
|
} else {
|
||||||
size = list->allocSize + 10;
|
size = list->allocSize + 10;
|
||||||
tmp = realloc(list->elements, sizeof(dbadr) * size);
|
tmp = realloc(list->elements, sizeof(dbadr) * size);
|
||||||
@ -939,8 +939,7 @@ deleteDump(struct rx_call *call, dumpId id, budb_dumpsList *dumps)
|
|||||||
/* Record the dump just deleted */
|
/* Record the dump just deleted */
|
||||||
if (dumps && (dumps->budb_dumpsList_len < BUDB_MAX_RETURN_LIST)) {
|
if (dumps && (dumps->budb_dumpsList_len < BUDB_MAX_RETURN_LIST)) {
|
||||||
if (dumps->budb_dumpsList_len == 0)
|
if (dumps->budb_dumpsList_len == 0)
|
||||||
dumps->budb_dumpsList_val =
|
dumps->budb_dumpsList_val = malloc(sizeof(afs_int32));
|
||||||
(afs_int32 *) malloc(sizeof(afs_int32));
|
|
||||||
else
|
else
|
||||||
dumps->budb_dumpsList_val =
|
dumps->budb_dumpsList_val =
|
||||||
realloc(dumps->budb_dumpsList_val,
|
realloc(dumps->budb_dumpsList_val,
|
||||||
@ -1630,11 +1629,9 @@ ListDumps(struct rx_call *call, afs_int32 sflags, afs_int32 groupid,
|
|||||||
count += 10;
|
count += 10;
|
||||||
if (count == 10) {
|
if (count == 10) {
|
||||||
dumps->budb_dumpsList_val =
|
dumps->budb_dumpsList_val =
|
||||||
(afs_int32 *) malloc(count *
|
malloc(count * sizeof(afs_int32));
|
||||||
sizeof(afs_int32));
|
|
||||||
flags->budb_dumpsList_val =
|
flags->budb_dumpsList_val =
|
||||||
(afs_int32 *) malloc(count *
|
malloc(count * sizeof(afs_int32));
|
||||||
sizeof(afs_int32));
|
|
||||||
} else {
|
} else {
|
||||||
dumps->budb_dumpsList_val =
|
dumps->budb_dumpsList_val =
|
||||||
realloc(dumps->budb_dumpsList_val,
|
realloc(dumps->budb_dumpsList_val,
|
||||||
|
@ -285,7 +285,7 @@ parseServerList(struct cmd_item *itemPtr)
|
|||||||
LogDebug(3, "%d servers\n", nservers);
|
LogDebug(3, "%d servers\n", nservers);
|
||||||
|
|
||||||
/* now can allocate the space for the server arguments */
|
/* 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)
|
if (serverArgs == 0)
|
||||||
ERROR(-1);
|
ERROR(-1);
|
||||||
|
|
||||||
|
@ -1271,7 +1271,7 @@ BSA_Int16 BSAGetEnvironment(
|
|||||||
for (i=0; i< ADSM_ENV_STRS; i++) {
|
for (i=0; i< ADSM_ENV_STRS; i++) {
|
||||||
if ( *envP == NULL ) { /* watch for NULL pointers */
|
if ( *envP == NULL ) { /* watch for NULL pointers */
|
||||||
/* Allocating memory for *envP.*/
|
/* 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. */
|
/* copy the content of envString[i] to *envP. */
|
||||||
strcpy(*envP,envString[i]);
|
strcpy(*envP,envString[i]);
|
||||||
|
@ -42,8 +42,8 @@ threadEntryDir(void *anEntry, afs_int32 size, afs_int32 type)
|
|||||||
int tried;
|
int tried;
|
||||||
|
|
||||||
for (tried = 0; tried < 5; tried++) {
|
for (tried = 0; tried < 5; tried++) {
|
||||||
entryPtr = (dlqlinkP) malloc(sizeof(dlqlinkT));
|
entryPtr = malloc(sizeof(dlqlinkT));
|
||||||
entry = (char *)malloc(size);
|
entry = malloc(size);
|
||||||
if (entryPtr && entry)
|
if (entryPtr && entry)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ threadEntry(void *anEntry, afs_int32 size, afs_int32 type)
|
|||||||
|
|
||||||
for (tried = 0; tried < 5; tried++) {
|
for (tried = 0; tried < 5; tried++) {
|
||||||
entryPtr = (dlqlinkP) malloc(sizeof(dlqlinkT));
|
entryPtr = (dlqlinkP) malloc(sizeof(dlqlinkT));
|
||||||
entry = (char *)malloc(size);
|
entry = malloc(size);
|
||||||
if (entryPtr && entry)
|
if (entryPtr && entry)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -421,7 +421,7 @@ WorkerBee(struct cmd_syndesc *as, void *arock)
|
|||||||
/*
|
/*
|
||||||
* Initialize the tape block buffers
|
* Initialize the tape block buffers
|
||||||
*/
|
*/
|
||||||
tapeblock1 = (char *)malloc(3 * 16384);
|
tapeblock1 = malloc(3 * 16384);
|
||||||
if (tapeblock1 == NULL) {
|
if (tapeblock1 == NULL) {
|
||||||
printf("Failed to allocate I/O buffers.\n");
|
printf("Failed to allocate I/O buffers.\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -168,7 +168,7 @@ scanVolData(afs_int32 taskId, struct butm_tapeInfo *curTapePtr,
|
|||||||
|
|
||||||
memset(volumeHeader, 0, sizeof(struct volumeHeader));
|
memset(volumeHeader, 0, sizeof(struct volumeHeader));
|
||||||
|
|
||||||
block = (char *)malloc(2 * BUTM_BLOCKSIZE);
|
block = malloc(2 * BUTM_BLOCKSIZE);
|
||||||
if (!block)
|
if (!block)
|
||||||
return (TC_NOMEMORY);
|
return (TC_NOMEMORY);
|
||||||
buffer[0] = &block[sizeof(struct blockMark)];
|
buffer[0] = &block[sizeof(struct blockMark)];
|
||||||
|
@ -1060,8 +1060,7 @@ WorkerBee(struct cmd_syndesc *as, void *arock)
|
|||||||
/*initialize the dumpNode list */
|
/*initialize the dumpNode list */
|
||||||
InitNodeList(portOffset);
|
InitNodeList(portOffset);
|
||||||
|
|
||||||
deviceLatch =
|
deviceLatch = malloc(sizeof(struct deviceSyncNode));
|
||||||
(struct deviceSyncNode *)(malloc(sizeof(struct deviceSyncNode)));
|
|
||||||
Lock_Init(&(deviceLatch->lock));
|
Lock_Init(&(deviceLatch->lock));
|
||||||
deviceLatch->flags = 0;
|
deviceLatch->flags = 0;
|
||||||
|
|
||||||
@ -1208,11 +1207,11 @@ main(int argc, char **argv)
|
|||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
ts = calloc(1, sizeof(struct cmd_syndesc));
|
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->next = 0;
|
||||||
ti->data = "0";
|
ti->data = "0";
|
||||||
ts->parms[0].items = ti;
|
ts->parms[0].items = ti;
|
||||||
ti = (struct cmd_item *)malloc(sizeof(struct cmd_item));
|
ti = malloc(sizeof(struct cmd_item));
|
||||||
ti->next = 0;
|
ti->next = 0;
|
||||||
ti->data = "0";
|
ti->data = "0";
|
||||||
ts->parms[1].items = ti;
|
ts->parms[1].items = ti;
|
||||||
|
@ -146,7 +146,7 @@ STC_LabelTape(struct rx_call *acid, struct tc_tapeLabel *label, afs_uint32 *task
|
|||||||
if (callPermitted(acid) == 0)
|
if (callPermitted(acid) == 0)
|
||||||
return (TC_NOTPERMITTED);
|
return (TC_NOTPERMITTED);
|
||||||
|
|
||||||
ptr = (struct labelTapeIf *)malloc(sizeof(*ptr));
|
ptr = malloc(sizeof(*ptr));
|
||||||
if (!ptr)
|
if (!ptr)
|
||||||
ERROR_EXIT(TC_NOMEMORY);
|
ERROR_EXIT(TC_NOMEMORY);
|
||||||
memcpy(&ptr->label, label, sizeof(ptr->label));
|
memcpy(&ptr->label, label, sizeof(ptr->label));
|
||||||
@ -231,9 +231,8 @@ STC_PerformDump(struct rx_call *rxCallId, struct tc_dumpInterface *tcdiPtr, tc_d
|
|||||||
|
|
||||||
CopyTapeSetDesc(&(newNode->tapeSetDesc), &tcdiPtr->tapeSet);
|
CopyTapeSetDesc(&(newNode->tapeSetDesc), &tcdiPtr->tapeSet);
|
||||||
|
|
||||||
newNode->dumps = (struct tc_dumpDesc *)
|
newNode->dumps = malloc(sizeof(struct tc_dumpDesc) *
|
||||||
malloc(sizeof(struct tc_dumpDesc) *
|
tc_dumpArrayPtr->tc_dumpArray_len);
|
||||||
tc_dumpArrayPtr->tc_dumpArray_len);
|
|
||||||
newNode->arraySize = tc_dumpArrayPtr->tc_dumpArray_len;
|
newNode->arraySize = tc_dumpArrayPtr->tc_dumpArray_len;
|
||||||
CopyDumpDesc(newNode->dumps, tc_dumpArrayPtr);
|
CopyDumpDesc(newNode->dumps, tc_dumpArrayPtr);
|
||||||
|
|
||||||
@ -314,9 +313,8 @@ STC_PerformRestore(struct rx_call *acid, char *dumpSetName, tc_restoreArray *are
|
|||||||
/* this creates a node in list, alots an id for it and prepares it for locking */
|
/* this creates a node in list, alots an id for it and prepares it for locking */
|
||||||
CreateNode(&newNode);
|
CreateNode(&newNode);
|
||||||
|
|
||||||
newNode->restores = (struct tc_restoreDesc *)
|
newNode->restores = malloc(sizeof(struct tc_restoreDesc) *
|
||||||
malloc(sizeof(struct tc_restoreDesc) *
|
arestores->tc_restoreArray_len);
|
||||||
arestores->tc_restoreArray_len);
|
|
||||||
newNode->arraySize = arestores->tc_restoreArray_len;
|
newNode->arraySize = arestores->tc_restoreArray_len;
|
||||||
CopyRestoreDesc(newNode->restores, arestores);
|
CopyRestoreDesc(newNode->restores, arestores);
|
||||||
*taskID = newNode->taskID;
|
*taskID = newNode->taskID;
|
||||||
@ -477,7 +475,7 @@ STC_SaveDb(struct rx_call *rxCall, Date archiveTime, afs_uint32 *taskId)
|
|||||||
|
|
||||||
*taskId = allocTaskId();
|
*taskId = allocTaskId();
|
||||||
|
|
||||||
ptr = (struct saveDbIf *)malloc(sizeof(struct saveDbIf));
|
ptr = malloc(sizeof(struct saveDbIf));
|
||||||
if (!ptr)
|
if (!ptr)
|
||||||
ERROR_EXIT(TC_NOMEMORY);
|
ERROR_EXIT(TC_NOMEMORY);
|
||||||
ptr->archiveTime = archiveTime;
|
ptr->archiveTime = archiveTime;
|
||||||
@ -556,7 +554,7 @@ STC_ScanDumps(struct rx_call *acid, afs_int32 addDbFlag, afs_uint32 *taskId)
|
|||||||
|
|
||||||
*taskId = allocTaskId();
|
*taskId = allocTaskId();
|
||||||
|
|
||||||
ptr = (struct scanTapeIf *)malloc(sizeof(*ptr));
|
ptr = malloc(sizeof(*ptr));
|
||||||
if (!ptr)
|
if (!ptr)
|
||||||
ERROR_EXIT(TC_NOMEMORY);
|
ERROR_EXIT(TC_NOMEMORY);
|
||||||
ptr->addDbFlag = addDbFlag;
|
ptr->addDbFlag = addDbFlag;
|
||||||
@ -644,7 +642,7 @@ STC_DeleteDump(struct rx_call *acid, afs_uint32 dumpID, afs_uint32 *taskId)
|
|||||||
if (callPermitted(acid) == 0)
|
if (callPermitted(acid) == 0)
|
||||||
return (TC_NOTPERMITTED);
|
return (TC_NOTPERMITTED);
|
||||||
|
|
||||||
ptr = (struct deleteDumpIf *)malloc(sizeof(*ptr));
|
ptr = malloc(sizeof(*ptr));
|
||||||
if (!ptr)
|
if (!ptr)
|
||||||
ERROR_EXIT(TC_NOMEMORY);
|
ERROR_EXIT(TC_NOMEMORY);
|
||||||
|
|
||||||
|
@ -415,7 +415,7 @@ writeDbDump(struct butm_tapeInfo *tapeInfoPtr, afs_uint32 taskId,
|
|||||||
charList.charListT_val = 0;
|
charList.charListT_val = 0;
|
||||||
charList.charListT_len = 0;
|
charList.charListT_len = 0;
|
||||||
blockSize = BUTM_BLKSIZE;
|
blockSize = BUTM_BLKSIZE;
|
||||||
writeBlock = (char *)malloc(BUTM_BLOCKSIZE);
|
writeBlock = malloc(BUTM_BLOCKSIZE);
|
||||||
if (!writeBlock)
|
if (!writeBlock)
|
||||||
ERROR_EXIT(TC_NOMEMORY);
|
ERROR_EXIT(TC_NOMEMORY);
|
||||||
|
|
||||||
@ -1408,7 +1408,7 @@ restoreText(struct butm_tapeInfo *tapeInfo,
|
|||||||
udbClientTextP ctPtr = 0;
|
udbClientTextP ctPtr = 0;
|
||||||
afs_int32 textType;
|
afs_int32 textType;
|
||||||
|
|
||||||
ctPtr = (udbClientTextP) malloc(sizeof(*ctPtr));
|
ctPtr = malloc(sizeof(*ctPtr));
|
||||||
if (!ctPtr)
|
if (!ctPtr)
|
||||||
ERROR_EXIT(TC_NOMEMORY);
|
ERROR_EXIT(TC_NOMEMORY);
|
||||||
|
|
||||||
@ -1444,7 +1444,7 @@ restoreText(struct butm_tapeInfo *tapeInfo,
|
|||||||
|
|
||||||
/* allocate buffer for text */
|
/* allocate buffer for text */
|
||||||
readBlockSize = BUTM_BLKSIZE;
|
readBlockSize = BUTM_BLKSIZE;
|
||||||
readBuffer = (char *)malloc(readBlockSize);
|
readBuffer = malloc(readBlockSize);
|
||||||
if (!readBuffer)
|
if (!readBuffer)
|
||||||
ERROR_EXIT(TC_NOMEMORY);
|
ERROR_EXIT(TC_NOMEMORY);
|
||||||
|
|
||||||
@ -1533,7 +1533,7 @@ getTapeData(struct butm_tapeInfo *tapeInfoPtr,
|
|||||||
ERROR_EXIT(TC_ABORTEDBYREQUEST);
|
ERROR_EXIT(TC_ABORTEDBYREQUEST);
|
||||||
|
|
||||||
if (!tapeReadBuffer) {
|
if (!tapeReadBuffer) {
|
||||||
tapeReadBuffer = (char *)malloc(BUTM_BLOCKSIZE);
|
tapeReadBuffer = malloc(BUTM_BLOCKSIZE);
|
||||||
if (!tapeReadBuffer)
|
if (!tapeReadBuffer)
|
||||||
ERROR_EXIT(TC_NOMEMORY);
|
ERROR_EXIT(TC_NOMEMORY);
|
||||||
}
|
}
|
||||||
|
@ -103,8 +103,7 @@ PerformDump(struct cmd_syndesc *as, void *arock)
|
|||||||
strcpy(ttapeSet.format, "tapeName%u");
|
strcpy(ttapeSet.format, "tapeName%u");
|
||||||
strcpy(ttapeSet.tapeServer, "diskTapes");
|
strcpy(ttapeSet.tapeServer, "diskTapes");
|
||||||
tdumps.tc_dumpArray_val =
|
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;
|
ptr = tdumps.tc_dumpArray_val;
|
||||||
for (i = 0; i < tdumps.tc_dumpArray_len; i++) {
|
for (i = 0; i < tdumps.tc_dumpArray_len; i++) {
|
||||||
fscanf(fp, "%s\n", ptr->name);
|
fscanf(fp, "%s\n", ptr->name);
|
||||||
@ -146,9 +145,9 @@ PerformRestore(struct cmd_syndesc *as, void *arock)
|
|||||||
strcpy(tdumpSetName, "Test");
|
strcpy(tdumpSetName, "Test");
|
||||||
fp = fopen("restoreScr", "r");
|
fp = fopen("restoreScr", "r");
|
||||||
fscanf(fp, "%u\n", &trestores.tc_restoreArray_len);
|
fscanf(fp, "%u\n", &trestores.tc_restoreArray_len);
|
||||||
trestores.tc_restoreArray_val =
|
trestores.tc_restoreArray_val
|
||||||
(struct tc_restoreDesc *)malloc(trestores.tc_restoreArray_len *
|
= malloc(trestores.tc_restoreArray_len *
|
||||||
sizeof(struct tc_restoreDesc));
|
sizeof(struct tc_restoreDesc));
|
||||||
ptr = trestores.tc_restoreArray_val;
|
ptr = trestores.tc_restoreArray_val;
|
||||||
for (i = 0; i < trestores.tc_restoreArray_len; i++) {
|
for (i = 0; i < trestores.tc_restoreArray_len; i++) {
|
||||||
fscanf(fp, "%s\n", ptr->oldName);
|
fscanf(fp, "%s\n", ptr->oldName);
|
||||||
|
@ -1052,7 +1052,7 @@ file_Mount(struct butm_tapeInfo *info, char *tape)
|
|||||||
|
|
||||||
(void)PrepareAccess(fid); /* for NT */
|
(void)PrepareAccess(fid); /* for NT */
|
||||||
|
|
||||||
p = (struct progress *)malloc(sizeof(*p));
|
p = malloc(sizeof(*p));
|
||||||
info->tmRock = (char *)p;
|
info->tmRock = (char *)p;
|
||||||
p->fid = fid;
|
p->fid = fid;
|
||||||
p->mountId = config.mountId = time(0);
|
p->mountId = config.mountId = time(0);
|
||||||
|
@ -111,7 +111,7 @@ main(argc, argv)
|
|||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
goto usage;
|
goto usage;
|
||||||
|
|
||||||
files = (char **)malloc(argc * sizeof(char *));
|
files = malloc(argc * sizeof(char *));
|
||||||
nFiles = 0;
|
nFiles = 0;
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
if (argv[i][0] == '-') {
|
if (argv[i][0] == '-') {
|
||||||
@ -213,7 +213,7 @@ PerformDumpTest(TestInfo * tip)
|
|||||||
int i, past, code;
|
int i, past, code;
|
||||||
struct timeval tp;
|
struct timeval tp;
|
||||||
|
|
||||||
bufferBlock = (struct BufferBlock *)malloc(sizeof(struct BufferBlock));
|
bufferBlock = malloc(sizeof(struct BufferBlock));
|
||||||
|
|
||||||
info.structVersion = BUTM_MAJORVERSION;
|
info.structVersion = BUTM_MAJORVERSION;
|
||||||
if (code = butm_file_Instantiate(&info, tip->tc_Infop)) {
|
if (code = butm_file_Instantiate(&info, tip->tc_Infop)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user