From 58f3c3b8d518786764f45ac2be1f1f0850129125 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 18 Aug 2013 10:18:21 -0700 Subject: Stop casting pointers to (char *) when freeing them Signed-off-by: Alan Coopersmith --- src/add_window.c | 16 ++++++++-------- src/events.c | 20 ++++++++++---------- src/iconmgr.c | 2 +- src/icons.c | 8 ++++---- src/list.c | 2 +- src/menus.c | 6 +++--- src/session.c | 6 +++--- src/twm.c | 2 +- src/util.c | 6 +++--- 9 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/add_window.c b/src/add_window.c index 984e17b..2b08cc4 100644 --- a/src/add_window.c +++ b/src/add_window.c @@ -745,7 +745,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) if (XGetGeometry(dpy, tmp_win->w, &JunkRoot, &JunkX, &JunkY, &JunkWidth, &JunkHeight, &JunkBW, &JunkDepth) == 0) { - free((char *)tmp_win); + free(tmp_win); XUngrabServer(dpy); return(NULL); } @@ -1360,7 +1360,7 @@ FetchWmProtocols (TwmWindow *tmp) if (*ap == _XA_WM_SAVE_YOURSELF) flags |= DoesWmSaveYourself; if (*ap == _XA_WM_DELETE_WINDOW) flags |= DoesWmDeleteWindow; } - if (protocols) XFree ((char *) protocols); + if (protocols) XFree (protocols); } tmp->protocols = flags; } @@ -1372,7 +1372,7 @@ CreateTwmColormap(Colormap c) cmap = (TwmColormap *) malloc(sizeof(TwmColormap)); if (!cmap || XSaveContext(dpy, c, ColormapContext, (caddr_t) cmap)) { - if (cmap) free((char *) cmap); + if (cmap) free(cmap); return (NULL); } cmap->c = c; @@ -1394,7 +1394,7 @@ CreateColormapWindow(Window w, Bool creating_parent, Bool property_window) if (cwin) { if (!XGetWindowAttributes(dpy, w, &attributes) || XSaveContext(dpy, w, ColormapContext, (caddr_t) cwin)) { - free((char *) cwin); + free(cwin); return (NULL); } @@ -1403,7 +1403,7 @@ CreateColormapWindow(Window w, Bool creating_parent, Bool property_window) cwin->colormap = cmap = CreateTwmColormap(attributes.colormap); if (!cmap) { XDeleteContext(dpy, w, ColormapContext); - free((char *) cwin); + free(cwin); return (NULL); } } else { @@ -1481,7 +1481,7 @@ FetchWmColormapWindows (TwmWindow *tmp) for (i = 0; i < number_cmap_windows; i++) { /* append rest */ new_cmap_windows[i+1] = cmap_windows[i]; } - XFree ((char *) cmap_windows); + XFree (cmap_windows); can_free_cmap_windows = True; /* do not use XFree any more */ cmap_windows = new_cmap_windows; number_cmap_windows++; @@ -1559,9 +1559,9 @@ FetchWmColormapWindows (TwmWindow *tmp) done: if (cmap_windows) { if (can_free_cmap_windows) - free ((char *) cmap_windows); + free (cmap_windows); else - XFree ((char *) cmap_windows); + XFree (cmap_windows); } return; diff --git a/src/events.c b/src/events.c index 5b661f6..ac26d88 100644 --- a/src/events.c +++ b/src/events.c @@ -404,7 +404,7 @@ HandleColormapNotify(void) if (cmap->refcnt == 0) { XDeleteContext(dpy, cmap->c, ColormapContext); - free((char *) cmap); + free(cmap); } return; @@ -714,13 +714,13 @@ free_cwins (TwmWindow *tmp) cmap = tmp->cmaps.cwins[i]->colormap; if (--cmap->refcnt == 0) { XDeleteContext(dpy, cmap->c, ColormapContext); - free((char *) cmap); + free(cmap); } XDeleteContext(dpy, tmp->cmaps.cwins[i]->w, ColormapContext); - free((char *) tmp->cmaps.cwins[i]); + free(tmp->cmaps.cwins[i]); } } - free((char *) tmp->cmaps.cwins); + free(tmp->cmaps.cwins); if (tmp->cmaps.number_cwins > 1) { free(tmp->cmaps.scoreboard); tmp->cmaps.scoreboard = NULL; @@ -807,7 +807,7 @@ HandlePropertyNotify(void) break; case XA_WM_HINTS: - if (Tmp_win->wmhints) XFree ((char *) Tmp_win->wmhints); + if (Tmp_win->wmhints) XFree (Tmp_win->wmhints); Tmp_win->wmhints = XGetWMHints(dpy, Event.xany.window); if (Tmp_win->wmhints && (Tmp_win->wmhints->flags & WindowGroupHint)) @@ -1244,20 +1244,20 @@ HandleDestroyNotify(void) free_window_names (Tmp_win, True, True, True); /* 1, 2, 3 */ if (Tmp_win->wmhints) /* 4 */ - XFree ((char *)Tmp_win->wmhints); + XFree (Tmp_win->wmhints); if (Tmp_win->class.res_name && Tmp_win->class.res_name != NoName) /* 5 */ - XFree ((char *)Tmp_win->class.res_name); + XFree (Tmp_win->class.res_name); if (Tmp_win->class.res_class && Tmp_win->class.res_class != NoName) /* 6 */ - XFree ((char *)Tmp_win->class.res_class); + XFree (Tmp_win->class.res_class); free_cwins (Tmp_win); /* 9 */ if (Tmp_win->titlebuttons) /* 10 */ - free ((char *) Tmp_win->titlebuttons); + free (Tmp_win->titlebuttons); remove_window_from_ring (Tmp_win); /* 11 */ if (UnHighLight_win == Tmp_win) UnHighLight_win = NULL; - free((char *)Tmp_win); + free(Tmp_win); } diff --git a/src/iconmgr.c b/src/iconmgr.c index 78e88b3..f7b01f0 100644 --- a/src/iconmgr.c +++ b/src/iconmgr.c @@ -534,7 +534,7 @@ void RemoveIconManager(TwmWindow *tmp_win) XDeleteContext(dpy, tmp->w, ScreenContext); XDestroyWindow(dpy, tmp->w); ip->count -= 1; - free((char *) tmp); + free(tmp); PackIconManager(ip); diff --git a/src/icons.c b/src/icons.c index 76b8a68..ad99888 100644 --- a/src/icons.c +++ b/src/icons.c @@ -243,7 +243,7 @@ IconDown (TwmWindow *tmp_win) { ip->next = ie->next; mergeEntries (ie, ip); - free ((char *) ie); + free (ie); ie = ip; ip = prevIconEntry (ip, ir); } else if (in && in->used == 0 && @@ -252,7 +252,7 @@ IconDown (TwmWindow *tmp_win) { ie->next = in->next; mergeEntries (in, ie); - free ((char *) in); + free (in); in = ie->next; } else break; @@ -311,7 +311,7 @@ FreeIconEntries (IconRegion *ir) for (ie = ir->entries; ie; ie=tmp) { tmp = ie->next; - free ((char *) ie); + free (ie); } } @@ -325,7 +325,7 @@ FreeIconRegions(void) tmp = ir; FreeIconEntries (ir); ir = ir->next; - free((char *) tmp); + free(tmp); } Scr->FirstRegion = NULL; Scr->LastRegion = NULL; diff --git a/src/list.c b/src/list.c index 134e44f..992721d 100644 --- a/src/list.c +++ b/src/list.c @@ -210,7 +210,7 @@ void FreeList(name_list **list) for (nptr = *list; nptr != NULL; ) { tmp = nptr->next; - free((char *) nptr); + free(nptr); nptr = tmp; } *list = NULL; diff --git a/src/menus.c b/src/menus.c index 1296025..4acfe85 100644 --- a/src/menus.c +++ b/src/menus.c @@ -157,7 +157,7 @@ InitMenus(void) free(key->name); tmp = key; key = key->next; - free((char *) tmp); + free(tmp); } Scr->FuncKeyRoot.next = NULL; } @@ -2777,7 +2777,7 @@ BumpWindowColormap (TwmWindow *tmp, int inc) cwins[j] = tmp->cmaps.cwins[i]; } - free((char *) tmp->cmaps.cwins); + free(tmp->cmaps.cwins); tmp->cmaps.cwins = cwins; @@ -2838,7 +2838,7 @@ DestroyMenu (MenuRoot *menu) for (item = menu->first; item; ) { MenuItem *tmp = item; item = item->next; - free ((char *) tmp); + free (tmp); } } diff --git a/src/session.c b/src/session.c index 4dd91c3..7eaef4d 100644 --- a/src/session.c +++ b/src/session.c @@ -501,9 +501,9 @@ give_up: free (entry->wm_command[i]); } if (entry->wm_command) - free ((char *) entry->wm_command); + free (entry->wm_command); - free ((char *) entry); + free (entry); *pentry = NULL; return 0; @@ -890,7 +890,7 @@ SaveYourselfPhase2CB (SmcConn smcConn, SmPointer clientData) props[1] = &prop2; SmcSetProperties (smcConn, 2, props); - free ((char *) prop1.vals); + free (prop1.vals); bad: SmcSaveYourselfDone (smcConn, success); diff --git a/src/twm.c b/src/twm.c index 112bdeb..31b6b62 100644 --- a/src/twm.c +++ b/src/twm.c @@ -602,7 +602,7 @@ main(int argc, char *argv[]) } } } - XFree ((char *) wmhintsp); + XFree (wmhintsp); } } } diff --git a/src/util.c b/src/util.c index efed81f..413b8d0 100644 --- a/src/util.c +++ b/src/util.c @@ -404,7 +404,7 @@ InsertRGBColormap (Atom a, XStandardColormap *maps, int nmaps, Bool replace) } if (replace) { /* just update contents */ - if (sc->maps) XFree ((char *) maps); + if (sc->maps) XFree (maps); if (sc == Scr->StdCmapInfo.mru) Scr->StdCmapInfo.mru = NULL; } else { /* else appending */ sc->next = NULL; @@ -433,7 +433,7 @@ RemoveRGBColormap (Atom a) prev = sc; } if (sc) { /* found one */ - if (sc->maps) XFree ((char *) sc->maps); + if (sc->maps) XFree (sc->maps); if (prev) prev->next = sc->next; if (Scr->StdCmapInfo.head == sc) Scr->StdCmapInfo.head = sc->next; if (Scr->StdCmapInfo.tail == sc) Scr->StdCmapInfo.tail = prev; @@ -459,7 +459,7 @@ LocateStandardColormaps(void) InsertRGBColormap (atoms[i], maps, nmaps, False); } } - if (atoms) XFree ((char *) atoms); + if (atoms) XFree (atoms); return; } -- cgit v1.2.3