summaryrefslogtreecommitdiff
path: root/src/menus.c
diff options
context:
space:
mode:
authorTim Wiederhake <twied@gmx.net>2023-12-30 20:49:48 +0100
committerTim Wiederhake <twied@gmx.net>2024-01-21 13:14:37 +0100
commit365a94b62df6144ad016e587f3756d974b6e2018 (patch)
tree08182cf099e612ba7830c929375c56c06035368a /src/menus.c
parent7fe0acdb259c7dd9f3b6214ba16f272da81beadb (diff)
Add explicit cast after memory allocation
Still valid c, but now also valid c++. Signed-off-by: Tim Wiederhake <twied@gmx.net>
Diffstat (limited to 'src/menus.c')
-rw-r--r--src/menus.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/menus.c b/src/menus.c
index 39d6d34..44e0904 100644
--- a/src/menus.c
+++ b/src/menus.c
@@ -194,7 +194,7 @@ AddFuncKey(char *name, int cont, int mods2, int func, char *win_name,
}
if (tmp == NULL) {
- tmp = malloc(sizeof(FuncKey));
+ tmp = (FuncKey *) malloc(sizeof(FuncKey));
tmp->next = Scr->FuncKeyRoot.next;
Scr->FuncKeyRoot.next = tmp;
}
@@ -215,7 +215,7 @@ int
CreateTitleButton(const char *name, int func, const char *action,
MenuRoot *menuroot, Bool rightside, Bool append)
{
- TitleButton *tb = malloc(sizeof(TitleButton));
+ TitleButton *tb = (TitleButton *) malloc(sizeof(TitleButton));
if (!tb) {
twmWarning("unable to allocate %lu bytes for title button",
@@ -606,7 +606,7 @@ NewMenuRoot(const char *name)
#define UNUSED_PIXEL ((unsigned long) (~0)) /* more than 24 bits */
- tmp = malloc(sizeof(MenuRoot));
+ tmp = (MenuRoot *) malloc(sizeof(MenuRoot));
tmp->hi_fore = UNUSED_PIXEL;
tmp->hi_back = UNUSED_PIXEL;
tmp->name = name;
@@ -665,7 +665,7 @@ AddToMenu(MenuRoot *menu, const char *item, const char *action,
item, action ? action : "<null>", sub, func);
#endif
- tmp = malloc(sizeof(MenuItem));
+ tmp = (MenuItem *) malloc(sizeof(MenuItem));
tmp->root = menu;
if (menu->first == NULL) {
@@ -955,7 +955,7 @@ PopUpMenu(MenuRoot *menu, int x, int y, Bool center)
if (WindowNameCount != 0) {
int i;
- WindowNames =
+ WindowNames = (TwmWindow **)
malloc(sizeof(TwmWindow *) * (size_t) WindowNameCount);
WindowNames[0] = Scr->TwmRoot.next;
@@ -2309,7 +2309,7 @@ Execute(const char *s)
colon = strrchr(ds, ':');
if (colon) { /* if host[:]:dpy */
size_t need = sizeof(display_eqls) + strlen(ds) + 10;
- char *update = malloc(need);
+ char *update = (char *) malloc(need);
if (update != NULL) {
char *dot1;
@@ -2333,7 +2333,7 @@ Execute(const char *s)
if (restorevar) {
size_t need = sizeof(display_eqls) + strlen(oldDisplay);
- char *update = malloc(need);
+ char *update = (char *) malloc(need);
if (update != NULL) {
(void) snprintf(update, need, "%s%s", display_eqls, oldDisplay);
@@ -2685,7 +2685,7 @@ BumpWindowColormap(TwmWindow *tmp, int inc)
return;
if (inc && tmp->cmaps.number_cwins > 0) {
- cwins =
+ cwins = (ColormapWindow **)
malloc(sizeof(ColormapWindow *) * (size_t) tmp->cmaps.number_cwins);
if (cwins) {
int i;