mirror of
https://git.openafs.org/openafs.git
synced 2025-01-20 16:00:12 +00:00
util: 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: I8287709413fe0e34f417936d1fc64c421fea6d28 Reviewed-on: http://gerrit.openafs.org/7472 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@dementix.org>
This commit is contained in:
parent
1c734bd7e5
commit
152bda64c6
@ -569,7 +569,7 @@ ConstructLocalPath(const char *cpath, const char *relativeTo,
|
||||
/* construct path relative to install directory only */
|
||||
pathSize += strlen(cpath);
|
||||
|
||||
newPath = (char *)malloc(pathSize);
|
||||
newPath = malloc(pathSize);
|
||||
if (!newPath) {
|
||||
status = ENOMEM;
|
||||
} else {
|
||||
@ -579,7 +579,7 @@ ConstructLocalPath(const char *cpath, const char *relativeTo,
|
||||
/* construct path relative to 'relativeTo' (and install dir) */
|
||||
pathSize += strlen(relativeTo) + 1 + strlen(cpath);
|
||||
|
||||
newPath = (char *)malloc(pathSize);
|
||||
newPath = malloc(pathSize);
|
||||
if (!newPath) {
|
||||
status = ENOMEM;
|
||||
} else {
|
||||
|
@ -102,7 +102,7 @@ BufioOpen(char *path, int oflag, int mode)
|
||||
{
|
||||
bufio_p bp;
|
||||
|
||||
bp = (bufio_p) malloc(sizeof(bufio_t));
|
||||
bp = malloc(sizeof(bufio_t));
|
||||
if (bp == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ gettmpdir(void)
|
||||
|
||||
if (saveTmpDir == NULL) {
|
||||
/* initialize global temporary directory string */
|
||||
char *dirp = (char *)malloc(MAX_PATH+1);
|
||||
char *dirp = malloc(MAX_PATH+1);
|
||||
int freeDirp = 1;
|
||||
|
||||
if (dirp != NULL) {
|
||||
|
@ -337,13 +337,12 @@ util_newCellContents(struct util_Table* Table) {
|
||||
char **CellContents=NULL;
|
||||
int i;
|
||||
|
||||
if ( (CellContents=(char **) malloc( sizeof(char *) * Table->numColumns))\
|
||||
== NULL ) {
|
||||
if ( (CellContents=malloc( sizeof(char *) * Table->numColumns))== NULL ) {
|
||||
fprintf(stderr,"Internal Error. Cannot allocate memory for new CellContents-array.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
for (i=0;i<Table->numColumns;i++) {
|
||||
if ( (CellContents[i]=(char *) malloc(UTIL_T_MAX_CELLCONTENT_LEN)) == NULL) {
|
||||
if ( (CellContents[i]=malloc(UTIL_T_MAX_CELLCONTENT_LEN)) == NULL) {
|
||||
fprintf(stderr,\
|
||||
"Internal Error. Cannot allocate memory for new CellContents-array.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
@ -417,7 +416,7 @@ struct util_TableRow*
|
||||
newTableRow(struct util_Table* Table) {
|
||||
struct util_TableRow *aRow =NULL;
|
||||
|
||||
if ( (aRow= (struct util_TableRow*) malloc(sizeof(struct util_TableRow))) == NULL) {
|
||||
if ( (aRow = malloc(sizeof(struct util_TableRow))) == NULL) {
|
||||
fprintf(stderr,\
|
||||
"Internal Error. Cannot allocate memory for new TableRow.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
|
@ -1180,7 +1180,7 @@ afs_wq_node_alloc(struct afs_work_queue_node ** node_out)
|
||||
int ret = 0;
|
||||
struct afs_work_queue_node * node;
|
||||
|
||||
*node_out = node = (struct afs_work_queue_node *) malloc(sizeof(*node));
|
||||
*node_out = node = malloc(sizeof(*node));
|
||||
if (node == NULL) {
|
||||
ret = ENOMEM;
|
||||
goto error;
|
||||
|
Loading…
Reference in New Issue
Block a user