mirror of
https://git.openafs.org/openafs.git
synced 2025-01-20 16:00:12 +00:00
afsmonitor & gtx: 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: I74b1f3ba3000ecaeb3da8eb3201f6050c9972c4e Reviewed-on: http://gerrit.openafs.org/7464 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@dementix.org>
This commit is contained in:
parent
cbdf31d9ff
commit
b0ccfea010
@ -1153,9 +1153,7 @@ create_ovwFrame_objects(void)
|
||||
ovw_numHosts_perPage = maxY - OVW_NUM_FIXED_LINES;
|
||||
|
||||
/* allocate memory for a list of onode pointers for file server names */
|
||||
ovw_fsNames_o =
|
||||
(struct onode **)malloc(sizeof(struct onode *) *
|
||||
ovw_numHosts_perPage);
|
||||
ovw_fsNames_o = malloc(sizeof(struct onode *) * ovw_numHosts_perPage);
|
||||
if (ovw_fsNames_o == NULL) {
|
||||
sprintf(errMsg, "[ %s ] Failed to allocate memory for FS onodes\n",
|
||||
rn);
|
||||
@ -1186,9 +1184,7 @@ create_ovwFrame_objects(void)
|
||||
|
||||
|
||||
/* allocate memory for a list of onode pointers for cache manager names */
|
||||
ovw_cmNames_o =
|
||||
(struct onode **)malloc(sizeof(struct onode *) *
|
||||
ovw_numHosts_perPage);
|
||||
ovw_cmNames_o = malloc(sizeof(struct onode *) * ovw_numHosts_perPage);
|
||||
if (ovw_cmNames_o == NULL) {
|
||||
sprintf(errMsg, "[ %s ] Failed to allocate memory for CM onodes\n",
|
||||
rn);
|
||||
@ -2189,7 +2185,7 @@ create_FSframe_objects(void)
|
||||
* the file server statistics */
|
||||
|
||||
numBytes = fs_numHosts_perPage * sizeof(struct ServerInfo_line);
|
||||
fs_lines = (struct ServerInfo_line *)malloc(numBytes);
|
||||
fs_lines = malloc(numBytes);
|
||||
if (fs_lines == (struct ServerInfo_line *)0) {
|
||||
sprintf(errMsg,
|
||||
"[ %s ] Failed to allocate %d bytes for FS data lines\n", rn,
|
||||
@ -2204,7 +2200,7 @@ create_FSframe_objects(void)
|
||||
for (i = 0; i < fs_numHosts_perPage; i++) {
|
||||
for (arrIdx = 0; arrIdx < 2; arrIdx++) {
|
||||
numBytes = fs_cols_perPage * sizeof(struct onode *);
|
||||
fs_lines_Ptr->data_o[arrIdx] = (struct onode **)malloc(numBytes);
|
||||
fs_lines_Ptr->data_o[arrIdx] = malloc(numBytes);
|
||||
if (fs_lines_Ptr->data_o[arrIdx] == NULL) {
|
||||
sprintf(errMsg,
|
||||
"[ %s ] Failed to allocate %d bytes for FS data onodes\n",
|
||||
@ -2276,8 +2272,7 @@ create_FSframe_objects(void)
|
||||
* labels */
|
||||
for (arrIdx = 0; arrIdx < 3; arrIdx++) {
|
||||
|
||||
fsLabels_o[arrIdx] =
|
||||
(struct onode **)malloc(sizeof(struct onode *) * fs_cols_perPage);
|
||||
fsLabels_o[arrIdx] = malloc(sizeof(struct onode *) * fs_cols_perPage);
|
||||
if (fsLabels_o[arrIdx] == NULL) {
|
||||
sprintf(errMsg,
|
||||
"[ %s ] Failed to allocate memory for FS label onodes\n",
|
||||
@ -2971,7 +2966,7 @@ create_CMframe_objects(void)
|
||||
* the file server statistics */
|
||||
|
||||
numBytes = cm_numHosts_perPage * sizeof(struct ServerInfo_line);
|
||||
cm_lines = (struct ServerInfo_line *)malloc(numBytes);
|
||||
cm_lines = malloc(numBytes);
|
||||
if (cm_lines == (struct ServerInfo_line *)0) {
|
||||
sprintf(errMsg,
|
||||
"[ %s ] Failed to allocate %d bytes for CM data lines\n", rn,
|
||||
@ -2986,7 +2981,7 @@ create_CMframe_objects(void)
|
||||
for (i = 0; i < cm_numHosts_perPage; i++) {
|
||||
for (arrIdx = 0; arrIdx < 2; arrIdx++) {
|
||||
numBytes = cm_cols_perPage * sizeof(struct onode *);
|
||||
cm_lines_Ptr->data_o[arrIdx] = (struct onode **)malloc(numBytes);
|
||||
cm_lines_Ptr->data_o[arrIdx] = malloc(numBytes);
|
||||
if (cm_lines_Ptr->data_o[arrIdx] == NULL) {
|
||||
sprintf(errMsg,
|
||||
"[ %s ] Failed to allocate %d bytes for CM data onodes\n",
|
||||
@ -3058,8 +3053,7 @@ create_CMframe_objects(void)
|
||||
* labels */
|
||||
for (arrIdx = 0; arrIdx < 3; arrIdx++) {
|
||||
|
||||
cmLabels_o[arrIdx] =
|
||||
(struct onode **)malloc(sizeof(struct onode *) * cm_cols_perPage);
|
||||
cmLabels_o[arrIdx] = malloc(sizeof(struct onode *) * cm_cols_perPage);
|
||||
if (cmLabels_o[arrIdx] == NULL) {
|
||||
sprintf(errMsg,
|
||||
"[ %s ] Failed to allocate memory for CM label onodes\n",
|
||||
|
@ -569,8 +569,7 @@ insert_FS(char *a_hostName) /* name of cache manager to be inserted in list */
|
||||
|
||||
if (*a_hostName == '\0')
|
||||
return (-1);
|
||||
curr_item = (struct afsmon_hostEntry *)
|
||||
malloc(sizeof(struct afsmon_hostEntry));
|
||||
curr_item = malloc(sizeof(struct afsmon_hostEntry));
|
||||
if (curr_item == (struct afsmon_hostEntry *)0) {
|
||||
fprintf(stderr, "Failed to allocate space for FS nameList\n");
|
||||
return (-1);
|
||||
@ -656,8 +655,7 @@ insert_CM(char *a_hostName) /* name of cache manager to be inserted in list */
|
||||
|
||||
if (*a_hostName == '\0')
|
||||
return (-1);
|
||||
curr_item = (struct afsmon_hostEntry *)
|
||||
malloc(sizeof(struct afsmon_hostEntry));
|
||||
curr_item = malloc(sizeof(struct afsmon_hostEntry));
|
||||
if (curr_item == (struct afsmon_hostEntry *)0) {
|
||||
fprintf(stderr, "Failed to allocate space for CM nameList\n");
|
||||
return (-1);
|
||||
@ -1539,7 +1537,7 @@ process_config_file(char *a_config_filename)
|
||||
}
|
||||
if (curr_host->numThresh) {
|
||||
numBytes = curr_host->numThresh * sizeof(struct Threshold);
|
||||
curr_host->thresh = (struct Threshold *)malloc(numBytes);
|
||||
curr_host->thresh = malloc(numBytes);
|
||||
if (curr_host->thresh == NULL) {
|
||||
fprintf(stderr, "[ %s ] Memory Allocation error 1", rn);
|
||||
afsmon_Exit(25);
|
||||
@ -1557,7 +1555,7 @@ process_config_file(char *a_config_filename)
|
||||
}
|
||||
if (curr_host->numThresh) {
|
||||
numBytes = curr_host->numThresh * sizeof(struct Threshold);
|
||||
curr_host->thresh = (struct Threshold *)malloc(numBytes);
|
||||
curr_host->thresh = malloc(numBytes);
|
||||
if (curr_host->thresh == NULL) {
|
||||
fprintf(stderr, "[ %s ] Memory Allocation error 2", rn);
|
||||
afsmon_Exit(35);
|
||||
@ -3496,8 +3494,8 @@ init_cm_buffers(void)
|
||||
/* >>> need to allocate rx connection info structure here <<< */
|
||||
|
||||
new_cmPR->data.AFSCB_CollData_val =
|
||||
(afs_int32 *) malloc(XSTAT_CM_FULLPERF_RESULTS_LEN
|
||||
* sizeof(afs_int32));
|
||||
malloc(XSTAT_CM_FULLPERF_RESULTS_LEN
|
||||
*sizeof(afs_int32));
|
||||
if (new_cmPR->data.AFSCB_CollData_val == NULL) {
|
||||
free(new_cmlist_item);
|
||||
free(new_cmPR->connP);
|
||||
@ -3588,7 +3586,7 @@ init_print_buffers(void)
|
||||
|
||||
if (numFS) {
|
||||
numBytes = numFS * sizeof(struct fs_Display_Data);
|
||||
curr_fsData = (struct fs_Display_Data *)malloc(numBytes);
|
||||
curr_fsData = malloc(numBytes);
|
||||
if (curr_fsData == (struct fs_Display_Data *)0) {
|
||||
fprintf(stderr, "[ %s ] Memory allocation failure\n", rn);
|
||||
return (-1);
|
||||
@ -3596,7 +3594,7 @@ init_print_buffers(void)
|
||||
memset(curr_fsData, 0, numBytes);
|
||||
|
||||
numBytes = numFS * sizeof(struct fs_Display_Data);
|
||||
prev_fsData = (struct fs_Display_Data *)malloc(numBytes);
|
||||
prev_fsData = malloc(numBytes);
|
||||
if (prev_fsData == (struct fs_Display_Data *)0) {
|
||||
fprintf(stderr, "[ %s ] Memory allocation failure\n", rn);
|
||||
return (-5);
|
||||
@ -3625,7 +3623,7 @@ init_print_buffers(void)
|
||||
if (numCM) {
|
||||
numBytes = numCM * sizeof(struct cm_Display_Data);
|
||||
|
||||
curr_cmData = (struct cm_Display_Data *)malloc(numBytes);
|
||||
curr_cmData = malloc(numBytes);
|
||||
if (curr_cmData == (struct cm_Display_Data *)0) {
|
||||
fprintf(stderr, "[ %s ] Memory allocation failure\n", rn);
|
||||
return (-10);
|
||||
@ -3633,7 +3631,7 @@ init_print_buffers(void)
|
||||
memset(curr_cmData, 0, numBytes);
|
||||
|
||||
numBytes = numCM * sizeof(struct cm_Display_Data);
|
||||
prev_cmData = (struct cm_Display_Data *)malloc(numBytes);
|
||||
prev_cmData = malloc(numBytes);
|
||||
if (prev_cmData == (struct cm_Display_Data *)0) {
|
||||
fprintf(stderr, "[ %s ] Memory allocation failure\n", rn);
|
||||
return (-15);
|
||||
@ -3726,7 +3724,7 @@ afsmon_execute(void)
|
||||
/* Allocate an array of sockets for each fileserver we monitor */
|
||||
|
||||
FSsktbytes = numFS * sizeof(struct sockaddr_in);
|
||||
FSSktArray = (struct sockaddr_in *)malloc(FSsktbytes);
|
||||
FSSktArray = malloc(FSsktbytes);
|
||||
if (FSSktArray == (struct sockaddr_in *)0) {
|
||||
fprintf(stderr,
|
||||
"[ %s ] cannot malloc %d sockaddr_ins for fileservers\n",
|
||||
@ -3811,7 +3809,7 @@ afsmon_execute(void)
|
||||
/* Allocate an array of sockets for each cache manager we monitor */
|
||||
|
||||
CMsktbytes = numCM * sizeof(struct sockaddr_in);
|
||||
CMSktArray = (struct sockaddr_in *)malloc(CMsktbytes);
|
||||
CMSktArray = malloc(CMsktbytes);
|
||||
if (CMSktArray == (struct sockaddr_in *)0) {
|
||||
fprintf(stderr,
|
||||
"[ %s ] cannot malloc %d sockaddr_ins for CM entries\n",
|
||||
|
@ -107,8 +107,7 @@ gator_cursesgwin_init(int adebug)
|
||||
fprintf(stderr,
|
||||
"[%s:%s] Allocating %" AFS_SIZET_FMT " bytes for curses window private space in base window\n",
|
||||
mn, rn, sizeof(struct gator_cursesgwin));
|
||||
c_data =
|
||||
(struct gator_cursesgwin *)malloc(sizeof(struct gator_cursesgwin));
|
||||
c_data = malloc(sizeof(struct gator_cursesgwin));
|
||||
if (c_data == (struct gator_cursesgwin *)0) {
|
||||
fprintf(stderr,
|
||||
"[%s:%s] Can't allocate %" AFS_SIZET_FMT " bytes for curses window private space in base window\n",
|
||||
@ -191,7 +190,7 @@ gator_cursesgwin_create(void * rock)
|
||||
fprintf(stderr,
|
||||
"[%s:%s] Allocating %" AFS_SIZET_FMT " bytes for new gwin structure\n", mn,
|
||||
rn, sizeof(struct gwin));
|
||||
newgwin = (struct gwin *)malloc(sizeof(struct gwin));
|
||||
newgwin = malloc(sizeof(struct gwin));
|
||||
if (newgwin == NULL) {
|
||||
fprintf(stderr,
|
||||
"[%s:%s] Can't malloc() %" AFS_SIZET_FMT " bytes for new gwin structure: Errno is %d\n",
|
||||
@ -212,8 +211,7 @@ gator_cursesgwin_create(void * rock)
|
||||
fprintf(stderr,
|
||||
"[%s:%s] Allocating %" AFS_SIZET_FMT " bytes for curses window private space\n",
|
||||
mn, rn, sizeof(struct gator_cursesgwin));
|
||||
c_data =
|
||||
(struct gator_cursesgwin *)malloc(sizeof(struct gator_cursesgwin));
|
||||
c_data = malloc(sizeof(struct gator_cursesgwin));
|
||||
if (c_data == (struct gator_cursesgwin *)0) {
|
||||
fprintf(stderr,
|
||||
"[%s:%s] Can't allocate %" AFS_SIZET_FMT " bytes for curses window private space\n",
|
||||
|
@ -260,7 +260,7 @@ gtxframe_AskForString(struct gtx_frame *aframe, char *aprompt,
|
||||
if (aframe->defaultLine)
|
||||
free(aframe->defaultLine);
|
||||
aframe->promptLine = gtx_CopyString(aprompt);
|
||||
tp = aframe->defaultLine = (char *)malloc(1024);
|
||||
tp = aframe->defaultLine = malloc(1024);
|
||||
if (tp == NULL)
|
||||
return (-1);
|
||||
if (adefault)
|
||||
@ -338,7 +338,7 @@ ShowMessageLine(struct gtx_frame *aframe)
|
||||
strparms.x = 0;
|
||||
strparms.y = sizeparms.maxy - 1;
|
||||
strparms.highlight = 1;
|
||||
tp = strparms.s = (char *)malloc(1024);
|
||||
tp = strparms.s = malloc(1024);
|
||||
strcpy(tp, aframe->promptLine);
|
||||
strcat(tp, aframe->defaultLine);
|
||||
WOP_DRAWSTRING(aframe->window, &strparms);
|
||||
@ -395,8 +395,7 @@ gtxframe_Create(void)
|
||||
return ((struct gtx_frame *)0);
|
||||
}
|
||||
|
||||
newkeystate = (struct keymap_state *)
|
||||
malloc(sizeof(struct keymap_state));
|
||||
newkeystate = malloc(sizeof(struct keymap_state));
|
||||
if (newkeystate == (struct keymap_state *)0) {
|
||||
/*
|
||||
* Get rid of the frame AND the keymap before exiting.
|
||||
@ -486,7 +485,7 @@ gtxframe_AddToList(struct gtx_frame *aframe, struct onode *aobj)
|
||||
* OK, it's not alreadyt there. Create a new list object, fill it
|
||||
* in, and splice it on.
|
||||
*/
|
||||
tlist = (struct gtxframe_dlist *)malloc(sizeof(struct gtxframe_dlist));
|
||||
tlist = malloc(sizeof(struct gtxframe_dlist));
|
||||
if (tlist == (struct gtxframe_dlist *)0)
|
||||
return (-1);
|
||||
tlist->data = (char *)aobj;
|
||||
|
@ -78,8 +78,7 @@ gator_light_create(struct onode *light_onp, struct onode_createparams *params)
|
||||
* Allocate the private data area, including the lower-level
|
||||
* structure, then fill it in.
|
||||
*/
|
||||
light_data =
|
||||
(struct gator_lightobj *)malloc(sizeof(struct gator_lightobj));
|
||||
light_data = malloc(sizeof(struct gator_lightobj));
|
||||
if (light_data == (struct gator_lightobj *)0) {
|
||||
fprintf(stderr,
|
||||
"[%s:%s] Can't allocate %" AFS_SIZET_FMT " bytes for light object private data region, errno is %d\n",
|
||||
@ -87,8 +86,7 @@ gator_light_create(struct onode *light_onp, struct onode_createparams *params)
|
||||
return (errno);
|
||||
}
|
||||
|
||||
light_strparams =
|
||||
(struct gwin_strparams *)malloc(sizeof(struct gwin_strparams));
|
||||
light_strparams = malloc(sizeof(struct gwin_strparams));
|
||||
if (light_strparams == (struct gwin_strparams *)0) {
|
||||
fprintf(stderr,
|
||||
"[%s:%s] Can't allocate %" AFS_SIZET_FMT " bytes for light object label in private data region, errno is %d\n",
|
||||
|
@ -185,7 +185,7 @@ gator_objects_create(struct onode_createparams *params)
|
||||
fprintf(stderr,
|
||||
"[%s:%s] Allocating %" AFS_SIZET_FMT " bytes for new onode structure\n", mn,
|
||||
rn, sizeof(struct onode));
|
||||
new_onode = (struct onode *)malloc(sizeof(struct onode));
|
||||
new_onode = malloc(sizeof(struct onode));
|
||||
if (new_onode == NULL) {
|
||||
fprintf(stderr,
|
||||
"[%s:%s] Can't allocate %" AFS_SIZET_FMT " bytes for new onode structure; errno is %d\n",
|
||||
|
@ -118,7 +118,7 @@ gator_textcb_Create(int a_maxEntriesStored, int a_maxCharsPerEntry)
|
||||
return ((struct gator_textcb_hdr *)0);
|
||||
} else if (gator_textcb_debug)
|
||||
fprintf(stderr, "[%s] Text buffer allocated at %p\n", rn, newBuff);
|
||||
blankLine = (char *)malloc(a_maxCharsPerEntry + 1);
|
||||
blankLine = malloc(a_maxCharsPerEntry + 1);
|
||||
if (blankLine == NULL) {
|
||||
fprintf(stderr,
|
||||
"[%s] Can't allocate %d bytes for blank line buffer; errno is %d\n",
|
||||
@ -135,7 +135,7 @@ gator_textcb_Create(int a_maxEntriesStored, int a_maxCharsPerEntry)
|
||||
fprintf(stderr,
|
||||
"[%s] Allocating %d bytes for the %d text entry array items\n",
|
||||
rn, bytesToAllocate, a_maxEntriesStored);
|
||||
newEntries = (struct gator_textcb_entry *)malloc(bytesToAllocate);
|
||||
newEntries = malloc(bytesToAllocate);
|
||||
if (newEntries == (struct gator_textcb_entry *)0) {
|
||||
fprintf(stderr,
|
||||
"[%s] Can't allocate %d bytes for the %d-member text entry array; errno is %d\n",
|
||||
@ -155,7 +155,7 @@ gator_textcb_Create(int a_maxEntriesStored, int a_maxCharsPerEntry)
|
||||
fprintf(stderr,
|
||||
"[%s] Allocating %d bytes for the text circular buffer header\n",
|
||||
rn, bytesToAllocate);
|
||||
newHdr = (struct gator_textcb_hdr *)malloc(bytesToAllocate);
|
||||
newHdr = malloc(bytesToAllocate);
|
||||
if (newHdr == (struct gator_textcb_hdr *)0) {
|
||||
fprintf(stderr,
|
||||
"[%s] Can't allocate %d bytes for text circular buffer header; errno is %d\n",
|
||||
|
@ -84,7 +84,7 @@ gator_text_create(struct onode *text_onp, struct onode_createparams *params)
|
||||
fprintf(stderr,
|
||||
"[%s:%s] Allocating %" AFS_SIZET_FMT " bytes for text object private data region\n",
|
||||
mn, rn, sizeof(struct gator_textobj));
|
||||
text_data = (struct gator_textobj *)malloc(sizeof(struct gator_textobj));
|
||||
text_data = malloc(sizeof(struct gator_textobj));
|
||||
if (text_data == (struct gator_textobj *)0) {
|
||||
fprintf(stderr,
|
||||
"[%s:%s] Can't allocate %" AFS_SIZET_FMT " bytes for text object private data region, errno is %d\n",
|
||||
|
Loading…
Reference in New Issue
Block a user