len2 = strlen(s2);
if (len1 < len2)
- return ((char *)NULL);
+ return (NULL);
ptr = s1;
ptr++;
len1--;
}
- return ((char *)NULL);
+ return (NULL);
}
#endif
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);
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);
/* if it is a section/group name, find it in the fs_categories[] array */
found = 0;
- if (strcasestr(arg2, "_section") != (char *)NULL
- || strcasestr(arg2, "_group") != (char *)NULL) {
+ if (strcasestr(arg2, "_section") != NULL
+ || strcasestr(arg2, "_group") != NULL) {
idx = 0;
while (idx < FS_NUM_DATA_CATEGORIES) {
sscanf(fs_categories[idx], "%s %d %d", catName, &fromIdx,
/* if it is a group name, read its start/end indices and fill in the
* fs_Display_map[]. */
- if (strcasestr(arg2, "_group") != (char *)NULL) {
+ if (strcasestr(arg2, "_group") != NULL) {
if (fromIdx < 0 || toIdx < 0 || fromIdx > NUM_FS_STAT_ENTRIES
|| toIdx > NUM_FS_STAT_ENTRIES)
/* if it is a section name, get the count of number of groups in it and
* for each group fill in the start/end indices in the fs_Display_map[] */
- if (strcasestr(arg2, "_section") != (char *)NULL) {
+ if (strcasestr(arg2, "_section") != NULL) {
/* fromIdx is actually the number of groups in thi section */
numGroups = fromIdx;
/* for each group in section */
/* if it is a section/group name, find it in the cm_categories[] array */
found = 0;
- if (strcasestr(arg2, "_section") != (char *)NULL
- || strcasestr(arg2, "_group") != (char *)NULL) {
+ if (strcasestr(arg2, "_section") != NULL
+ || strcasestr(arg2, "_group") != NULL) {
idx = 0;
while (idx < CM_NUM_DATA_CATEGORIES) {
sscanf(cm_categories[idx], "%s %d %d", catName, &fromIdx,
/* if it is a group name, read its start/end indices and fill in the
* cm_Display_map[]. */
- if (strcasestr(arg2, "_group") != (char *)NULL) {
+ if (strcasestr(arg2, "_group") != NULL) {
if (fromIdx < 0 || toIdx < 0 || fromIdx > NUM_CM_STAT_ENTRIES
|| toIdx > NUM_CM_STAT_ENTRIES)
/* if it is a section name, get the count of number of groups in it and
* for each group fill in the start/end indices in the cm_Display_map[] */
- if (strcasestr(arg2, "_section") != (char *)NULL) {
+ if (strcasestr(arg2, "_section") != NULL) {
/* fromIdx is actually the number of groups in thi section */
numGroups = fromIdx;
/* for each group in section */
}
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);
}
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);
break;
case AFS_XSTATSCOLL_CBSTATS:
index = 1;
+ break;
default:
- if (index < 0) {
- fprintf(stderr, "[ %s ] collection number %d is out of range.\n",
- rn, xstat_fs_Results.collectionNumber);
- afsmon_Exit(51);
- }
+ fprintf(stderr, "[ %s ] collection number %d is out of range.\n",
+ rn, xstat_fs_Results.collectionNumber);
+ afsmon_Exit(51);
}
/* If a new probe cycle started, mark the list in the current buffer
/* >>> 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);
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);
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);
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);
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);
/* 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",
/* 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",