summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/add_window.c19
-rw-r--r--src/gram.y2
-rw-r--r--src/iconmgr.c4
-rw-r--r--src/icons.c8
-rw-r--r--src/list.c2
-rw-r--r--src/menus.c14
-rw-r--r--src/parse.c6
-rw-r--r--src/session.c12
-rw-r--r--src/twm.c8
-rw-r--r--src/util.c9
10 files changed, 38 insertions, 46 deletions
diff --git a/src/add_window.c b/src/add_window.c
index 2b08cc4..73465df 100644
--- a/src/add_window.c
+++ b/src/add_window.c
@@ -170,7 +170,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp)
#endif
/* allocate space for the twm window */
- tmp_win = (TwmWindow *)calloc(1, sizeof(TwmWindow));
+ tmp_win = calloc(1, sizeof(TwmWindow));
if (tmp_win == 0)
{
fprintf (stderr, "%s: Unable to allocate memory to manage window ID %lx.\n",
@@ -362,7 +362,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp)
{
if (!tmp_win->wmhints)
{
- tmp_win->wmhints = (XWMHints *)malloc(sizeof(XWMHints));
+ tmp_win->wmhints = malloc(sizeof(XWMHints));
tmp_win->wmhints->flags = 0;
}
tmp_win->wmhints->initial_state = IconicState;
@@ -1287,7 +1287,7 @@ static void CreateWindowTitlebarButtons (TwmWindow *tmp_win)
tmp_win->titlebuttons = NULL;
nb = Scr->TBInfo.nleft + Scr->TBInfo.nright;
if (nb > 0) {
- tmp_win->titlebuttons = (TBWindow *) malloc (nb * sizeof(TBWindow));
+ tmp_win->titlebuttons = malloc (nb * sizeof(TBWindow));
if (!tmp_win->titlebuttons) {
fprintf (stderr, "%s: unable to allocate %d titlebuttons\n",
ProgramName, nb);
@@ -1369,7 +1369,7 @@ TwmColormap *
CreateTwmColormap(Colormap c)
{
TwmColormap *cmap;
- cmap = (TwmColormap *) malloc(sizeof(TwmColormap));
+ cmap = malloc(sizeof(TwmColormap));
if (!cmap ||
XSaveContext(dpy, c, ColormapContext, (caddr_t) cmap)) {
if (cmap) free(cmap);
@@ -1390,7 +1390,7 @@ CreateColormapWindow(Window w, Bool creating_parent, Bool property_window)
TwmColormap *cmap;
XWindowAttributes attributes;
- cwin = (ColormapWindow *) malloc(sizeof(ColormapWindow));
+ cwin = malloc(sizeof(ColormapWindow));
if (cwin) {
if (!XGetWindowAttributes(dpy, w, &attributes) ||
XSaveContext(dpy, w, ColormapContext, (caddr_t) cwin)) {
@@ -1469,7 +1469,7 @@ FetchWmColormapWindows (TwmWindow *tmp)
}
if (i == number_cmap_windows) { /* not in list */
Window *new_cmap_windows =
- (Window *) malloc (sizeof(Window) * (number_cmap_windows + 1));
+ malloc (sizeof(Window) * (number_cmap_windows + 1));
if (!new_cmap_windows) {
fprintf (stderr,
@@ -1487,8 +1487,7 @@ FetchWmColormapWindows (TwmWindow *tmp)
number_cmap_windows++;
}
- cwins = (ColormapWindow **) malloc(sizeof(ColormapWindow *) *
- number_cmap_windows);
+ cwins = malloc(sizeof(ColormapWindow *) * number_cmap_windows);
if (cwins) {
for (i = 0; i < number_cmap_windows; i++) {
@@ -1533,7 +1532,7 @@ FetchWmColormapWindows (TwmWindow *tmp)
number_cmap_windows = 1;
- cwins = (ColormapWindow **) malloc(sizeof(ColormapWindow *));
+ cwins = malloc(sizeof(ColormapWindow *));
if (XFindContext(dpy, tmp->w, ColormapContext, (caddr_t *)&cwins[0]) ==
XCNOENT) {
cwins[0] = CreateColormapWindow(tmp->w,
@@ -1551,7 +1550,7 @@ FetchWmColormapWindows (TwmWindow *tmp)
tmp->cmaps.number_cwins = number_cmap_windows;
if (number_cmap_windows > 1)
tmp->cmaps.scoreboard =
- (char *) calloc(1, ColormapsScoreboardLength(&tmp->cmaps));
+ calloc(1, ColormapsScoreboardLength(&tmp->cmaps));
if (previously_installed)
InstallWindowColormaps(PropertyNotify, (TwmWindow *) NULL);
diff --git a/src/gram.y b/src/gram.y
index ef0152a..5f85327 100644
--- a/src/gram.y
+++ b/src/gram.y
@@ -652,7 +652,7 @@ button : BUTTON number { $$ = $2;
}
;
-string : STRING { ptr = (char *)malloc(strlen($1)+1);
+string : STRING { ptr = malloc(strlen($1)+1);
strcpy(ptr, $1);
RemoveDQuote(ptr);
$$ = ptr;
diff --git a/src/iconmgr.c b/src/iconmgr.c
index f7b01f0..d9c4e76 100644
--- a/src/iconmgr.c
+++ b/src/iconmgr.c
@@ -133,7 +133,7 @@ IconMgr *AllocateIconManager(char *name, char *icon_name, char *geom, int column
if (Scr->NoIconManagers)
return NULL;
- p = (IconMgr *)malloc(sizeof(IconMgr));
+ p = malloc(sizeof(IconMgr));
p->name = name;
p->icon_name = icon_name;
p->geometry = geom;
@@ -368,7 +368,7 @@ WList *AddIconManager(TwmWindow *tmp_win)
&tmp_win->class)) == NULL)
ip = &Scr->iconmgr;
- tmp = (WList *) malloc(sizeof(WList));
+ tmp = malloc(sizeof(WList));
tmp->iconmgr = ip;
tmp->next = NULL;
tmp->active = FALSE;
diff --git a/src/icons.c b/src/icons.c
index ad99888..617a1f7 100644
--- a/src/icons.c
+++ b/src/icons.c
@@ -58,7 +58,7 @@ splitEntry (IconEntry *ie, int grav1, int grav2, int w, int h)
if (w != ie->w)
splitEntry (ie, grav2, grav1, w, ie->h);
if (h != ie->h) {
- new = (IconEntry *)malloc (sizeof (IconEntry));
+ new = malloc (sizeof (IconEntry));
new->twm_win = 0;
new->used = 0;
new->next = ie->next;
@@ -79,7 +79,7 @@ splitEntry (IconEntry *ie, int grav1, int grav2, int w, int h)
if (h != ie->h)
splitEntry (ie, grav2, grav1, ie->w, h);
if (w != ie->w) {
- new = (IconEntry *)malloc (sizeof (IconEntry));
+ new = malloc (sizeof (IconEntry));
new->twm_win = 0;
new->used = 0;
new->next = ie->next;
@@ -266,7 +266,7 @@ AddIconRegion(char *geom, int grav1, int grav2, int stepx, int stepy)
IconRegion *ir;
int mask;
- ir = (IconRegion *)malloc(sizeof(IconRegion));
+ ir = malloc(sizeof(IconRegion));
ir->next = NULL;
if (Scr->LastRegion)
Scr->LastRegion->next = ir;
@@ -292,7 +292,7 @@ AddIconRegion(char *geom, int grav1, int grav2, int stepx, int stepy)
if (mask & YNegative)
ir->y += Scr->MyDisplayHeight - ir->h;
- ir->entries = (IconEntry *)malloc(sizeof(IconEntry));
+ ir->entries = malloc(sizeof(IconEntry));
ir->entries->next = 0;
ir->entries->x = ir->x;
ir->entries->y = ir->y;
diff --git a/src/list.c b/src/list.c
index 992721d..b43cd59 100644
--- a/src/list.c
+++ b/src/list.c
@@ -91,7 +91,7 @@ AddToList(name_list **list_head, char *name, char *ptr)
if (!list_head) return; /* ignore empty inserts */
- nptr = (name_list *)malloc(sizeof(name_list));
+ nptr = malloc(sizeof(name_list));
if (nptr == NULL)
{
twmrc_error_prefix();
diff --git a/src/menus.c b/src/menus.c
index 4acfe85..e311454 100644
--- a/src/menus.c
+++ b/src/menus.c
@@ -204,7 +204,7 @@ Bool AddFuncKey (char *name, int cont, int mods, int func, char *win_name,
if (tmp == NULL)
{
- tmp = (FuncKey *) malloc(sizeof(FuncKey));
+ tmp = malloc(sizeof(FuncKey));
tmp->next = Scr->FuncKeyRoot.next;
Scr->FuncKeyRoot.next = tmp;
}
@@ -226,7 +226,7 @@ Bool AddFuncKey (char *name, int cont, int mods, int func, char *win_name,
int CreateTitleButton (const char *name, int func, const char *action,
MenuRoot *menuroot, Bool rightside, Bool append)
{
- TitleButton *tb = (TitleButton *) malloc (sizeof(TitleButton));
+ TitleButton *tb = malloc (sizeof(TitleButton));
if (!tb) {
fprintf (stderr,
@@ -633,7 +633,7 @@ NewMenuRoot(const char *name)
#define UNUSED_PIXEL ((unsigned long) (~0)) /* more than 24 bits */
- tmp = (MenuRoot *) malloc(sizeof(MenuRoot));
+ tmp = malloc(sizeof(MenuRoot));
tmp->hi_fore = UNUSED_PIXEL;
tmp->hi_back = UNUSED_PIXEL;
tmp->name = name;
@@ -697,7 +697,7 @@ AddToMenu(MenuRoot *menu, const char *item, const char *action,
item, action, sub, func);
#endif
- tmp = (MenuItem *) malloc(sizeof(MenuItem));
+ tmp = malloc(sizeof(MenuItem));
tmp->root = menu;
if (menu->first == NULL)
@@ -999,8 +999,7 @@ PopUpMenu (MenuRoot *menu, int x, int y, Bool center)
WindowNameCount++;
if (WindowNameCount != 0)
{
- WindowNames =
- (TwmWindow **)malloc(sizeof(TwmWindow *)*WindowNameCount);
+ WindowNames = malloc(sizeof(TwmWindow *) * WindowNameCount);
WindowNames[0] = Scr->TwmRoot.next;
for(tmp_win = Scr->TwmRoot.next->next , WindowNameCount=1;
tmp_win != NULL;
@@ -2758,8 +2757,7 @@ BumpWindowColormap (TwmWindow *tmp, int inc)
if (!tmp) return;
if (inc && tmp->cmaps.number_cwins > 0) {
- cwins = (ColormapWindow **) malloc(sizeof(ColormapWindow *)*
- tmp->cmaps.number_cwins);
+ cwins = malloc(sizeof(ColormapWindow *) * tmp->cmaps.number_cwins);
if (cwins) {
if ((previously_installed =
/* SUPPRESS 560 */(Scr->cmapInfo.cmaps == &tmp->cmaps &&
diff --git a/src/parse.c b/src/parse.c
index 53cca49..6ae9685 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -992,13 +992,13 @@ do_var_savecolor(int key)
{
Cptr cptrav, cpnew;
if (!chead) {
- chead = (Cptr)malloc(sizeof(Cnode));
+ chead = malloc(sizeof(Cnode));
chead->i = key; chead->next = NULL;
}
else {
cptrav = chead;
while (cptrav->next != NULL) { cptrav = cptrav->next; }
- cpnew = (Cptr)malloc(sizeof(Cnode));
+ cpnew = malloc(sizeof(Cnode));
cpnew->i = key; cpnew->next = NULL; cptrav->next = cpnew;
}
}
@@ -1107,7 +1107,7 @@ do_squeeze_entry (name_list **list, char *name, int justify, int num, int denom)
if (HasShape) {
SqueezeInfo *sinfo;
- sinfo = (SqueezeInfo *) malloc (sizeof(SqueezeInfo));
+ sinfo = malloc (sizeof(SqueezeInfo));
if (!sinfo) {
twmrc_error_prefix();
diff --git a/src/session.c b/src/session.c
index 7eaef4d..e5ffb61 100644
--- a/src/session.c
+++ b/src/session.c
@@ -390,8 +390,7 @@ ReadWinConfigEntry (FILE *configFile, unsigned short version,
unsigned char byte;
int i;
- *pentry = entry = (TWMWinConfigEntry *) malloc (
- sizeof (TWMWinConfigEntry));
+ *pentry = entry = malloc (sizeof (TWMWinConfigEntry));
if (!*pentry)
return 0;
@@ -427,7 +426,7 @@ ReadWinConfigEntry (FILE *configFile, unsigned short version,
entry->wm_command = NULL;
else
{
- entry->wm_command = (char **) malloc (entry->wm_command_count *
+ entry->wm_command = malloc (entry->wm_command_count *
sizeof (char *));
if (!entry->wm_command)
@@ -703,7 +702,7 @@ unique_filename (
tmp = (char *) mktemp (tempFile);
if (tmp)
{
- char *ptr = (char *) malloc (strlen (tmp) + 1);
+ char *ptr = malloc (strlen (tmp) + 1);
strcpy (ptr, tmp);
return (ptr);
}
@@ -715,7 +714,7 @@ unique_filename (
char *ptr;
snprintf (tempFile, sizeof(tempFile), "%s/%sXXXXXX", path, prefix);
- ptr = (char *)malloc(strlen(tempFile) + 1);
+ ptr = malloc(strlen(tempFile) + 1);
if (ptr != NULL)
{
strcpy(ptr, tempFile);
@@ -839,8 +838,7 @@ SaveYourselfPhase2CB (SmcConn smcConn, SmPointer clientData)
prop1.name = SmRestartCommand;
prop1.type = SmLISTofARRAY8;
- prop1.vals = (SmPropValue *) malloc (
- (Argc + 4) * sizeof (SmPropValue));
+ prop1.vals = malloc ((Argc + 4) * sizeof (SmPropValue));
if (!prop1.vals)
{
diff --git a/src/twm.c b/src/twm.c
index 31b6b62..1a6ae95 100644
--- a/src/twm.c
+++ b/src/twm.c
@@ -375,7 +375,7 @@ main(int argc, char *argv[])
InfoLines = 0;
/* for simplicity, always allocate NumScreens ScreenInfo struct pointers */
- ScreenList = (ScreenInfo **) calloc (NumScreens, sizeof (ScreenInfo *));
+ ScreenList = calloc (NumScreens, sizeof (ScreenInfo *));
if (ScreenList == NULL)
{
fprintf (stderr, "%s: Unable to allocate memory for screen list, exiting.\n",
@@ -424,8 +424,7 @@ main(int argc, char *argv[])
numManaged ++;
/* Note: ScreenInfo struct is calloc'ed to initialize to zero. */
- Scr = ScreenList[scrnum] =
- (ScreenInfo *) calloc(1, sizeof(ScreenInfo));
+ Scr = ScreenList[scrnum] = calloc(1, sizeof(ScreenInfo));
if (Scr == NULL)
{
fprintf (stderr, "%s: unable to allocate memory for ScreenInfo structure for screen %d.\n",
@@ -473,8 +472,7 @@ main(int argc, char *argv[])
XSaveContext (dpy, Scr->Root, ScreenContext, (caddr_t) Scr);
Scr->TwmRoot.cmaps.number_cwins = 1;
- Scr->TwmRoot.cmaps.cwins =
- (ColormapWindow **) malloc(sizeof(ColormapWindow *));
+ Scr->TwmRoot.cmaps.cwins = malloc(sizeof(ColormapWindow *));
Scr->TwmRoot.cmaps.cwins[0] =
CreateColormapWindow(Scr->Root, True, False);
Scr->TwmRoot.cmaps.cwins[0]->visibility = VisibilityPartiallyObscured;
diff --git a/src/util.c b/src/util.c
index 413b8d0..9e5675a 100644
--- a/src/util.c
+++ b/src/util.c
@@ -262,7 +262,7 @@ ExpandFilename(char *name)
if (name[0] != '~') return name;
- newname = (char *) malloc (HomeLen + strlen(name) + 2);
+ newname = malloc (HomeLen + strlen(name) + 2);
if (!newname) {
fprintf (stderr,
"%s: unable to allocate %ld bytes to expand filename %s/%s\n",
@@ -354,8 +354,7 @@ FindBitmap (const char *name, unsigned *widthp, unsigned *heightp)
/*
* Attempt to find icon in old IconDirectory (now obsolete)
*/
- bigname = (char *) malloc (strlen(name) + strlen(Scr->IconDirectory) +
- 2);
+ bigname = malloc (strlen(name) + strlen(Scr->IconDirectory) + 2);
if (!bigname) {
fprintf (stderr,
"%s: unable to allocate memory for \"%s/%s\"\n",
@@ -395,7 +394,7 @@ InsertRGBColormap (Atom a, XStandardColormap *maps, int nmaps, Bool replace)
}
if (!sc) { /* no existing, allocate new */
- sc = (StdCmap *) malloc (sizeof (StdCmap));
+ sc = malloc (sizeof (StdCmap));
if (!sc) {
fprintf (stderr, "%s: unable to allocate %ld bytes for StdCmap\n",
ProgramName, (unsigned long)sizeof (StdCmap));
@@ -597,7 +596,7 @@ GetFont(MyFont *font)
XFreeFontSet(dpy, font->fontset);
}
- basename2 = (char *)malloc(strlen(font->name) + 3);
+ basename2 = malloc(strlen(font->name) + 3);
if (basename2) sprintf(basename2, "%s,*", font->name);
else basename2 = font->name;
if( (font->fontset = XCreateFontSet(dpy, basename2,