diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-11-13 14:33:08 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-11-13 14:33:08 -0800 |
commit | 9bf3f50c2a287a1d455df3e36e751604d7d50381 (patch) | |
tree | 88cb437c9895874cdd94ea1787817c8cded48d2d | |
parent | fd5e1e9ee9ed359e0ad0dddfbaa4d9c84dcb1810 (diff) |
Remove unnecessary casts from malloc() and free() calls
Not needed in C89 & later
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | list.c | 6 | ||||
-rw-r--r-- | multiVis.c | 11 | ||||
-rw-r--r-- | xwd.c | 4 |
3 files changed, 10 insertions, 11 deletions
@@ -63,7 +63,7 @@ add_to_list(list_ptr lp, void *item) while (lp->next) { lp = lp->next; } - if ((lp->next = (list_ptr) malloc(sizeof(list_item))) == NULL) { + if ((lp->next = malloc(sizeof(list_item))) == NULL) { return 0; } @@ -83,7 +83,7 @@ new_list(void) { list_ptr lp; - if ((lp = (list_ptr) malloc(sizeof(list_item)))) { + if ((lp = malloc(sizeof(list_item)))) { lp->next = NULL; lp->ptr.item = NULL; } @@ -106,7 +106,7 @@ dup_list_head(list_ptr lp, int start_at_curr) { list_ptr new_listp; - if ((new_listp = (list_ptr) malloc(sizeof(list_item))) == NULL) { + if ((new_listp = malloc(sizeof(list_item))) == NULL) { return (list_ptr) NULL; } @@ -747,8 +747,7 @@ make_region_list(Display *disp, Window win, XRectangle *bbox, src_in_image(base_src, numImageVisuals, pImageVisuals)) { /* find a window whose visual hasn't been put in list yet */ if (!src_in_region_list(base_src, image_regions)) { - if (!(new_reg = (image_region_type *) - malloc(sizeof(image_region_type)))) { + if (!(new_reg = malloc(sizeof(image_region_type)))) { return (list_ptr) NULL; } count++; @@ -796,7 +795,7 @@ make_region_list(Display *disp, Window win, XRectangle *bbox, } else { XDestroyRegion(new_reg->visible_region); - free((void *) new_reg); + free(new_reg); } } } @@ -815,7 +814,7 @@ static void destroy_image_region(image_region_type *image_region) { XDestroyRegion(image_region->visible_region); - free((void *) image_region); + free(image_region); } /** ------------------------------------------------------------------------ @@ -899,7 +898,7 @@ add_window_to_list(list_ptr image_wins, Window w, { image_win_type *new_src; - if ((new_src = (image_win_type *) malloc(sizeof(image_win_type))) == NULL) + if ((new_src = malloc(sizeof(image_win_type))) == NULL) return; new_src->win = w; @@ -1075,7 +1074,7 @@ GetXVisualInfo( /* Which X server (aka "display"). */ /* Process the pVisuals array. */ *numImageVisuals = 0; nImageVisualsAlloced = 1; - pIVis = *pImageVisuals = (XVisualInfo **) malloc(sizeof(XVisualInfo *)); + pIVis = *pImageVisuals = malloc(sizeof(XVisualInfo *)); while (--nVisuals >= 0) { nOVisuals = *numOverlayVisuals; pOVis = *pOverlayVisuals; @@ -236,7 +236,7 @@ Get24bitDirectColors(XColor **colors) int i, ncolors = 256; XColor *tcol; - *colors = tcol = (XColor *) malloc(sizeof(XColor) * ncolors); + *colors = tcol = malloc(sizeof(XColor) * ncolors); for (i = 0; i < ncolors; i++) { tcol[i].pixel = i << 16 | i << 8 | i; @@ -597,7 +597,7 @@ ReadColors(Visual *vis, Colormap cmap, XColor **colors) ncolors = vis->map_entries; - if (!(*colors = (XColor *) malloc(sizeof(XColor) * ncolors))) + if (!(*colors = malloc(sizeof(XColor) * ncolors))) Fatal_Error("Out of memory!"); if (vis->class == DirectColor || vis->class == TrueColor) { |