summaryrefslogtreecommitdiff
path: root/src/session.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/session.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/session.c')
-rw-r--r--src/session.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/session.c b/src/session.c
index 77e0d3a..92b25bb 100644
--- a/src/session.c
+++ b/src/session.c
@@ -216,7 +216,7 @@ read_counted_string(FILE *file, char **stringp)
data = 0;
}
else {
- data = malloc((unsigned) len + 1);
+ data = (char *) malloc((unsigned) len + 1);
if (!data)
return 0;
if (fread(data, (int) sizeof(char), (int) len, file) != len) {
@@ -368,7 +368,7 @@ ReadWinConfigEntry(FILE *configFile, unsigned short version,
unsigned char byte;
int i;
- *pentry = entry = malloc(sizeof(TWMWinConfigEntry));
+ *pentry = entry = (TWMWinConfigEntry *) malloc(sizeof(TWMWinConfigEntry));
if (!*pentry)
return 0;
@@ -402,8 +402,8 @@ ReadWinConfigEntry(FILE *configFile, unsigned short version,
if (entry->wm_command_count == 0)
entry->wm_command = NULL;
else {
- entry->wm_command = malloc((size_t) entry->wm_command_count *
- sizeof(char *));
+ entry->wm_command = (char **)
+ malloc((size_t) entry->wm_command_count * sizeof(char *));
if (!entry->wm_command)
goto give_up;
@@ -773,7 +773,8 @@ SaveYourselfPhase2CB(SmcConn smcConn2, SmPointer clientData _X_UNUSED)
prop1.name = strdup(SmRestartCommand);
prop1.type = strdup(SmLISTofARRAY8);
- prop1.vals = malloc((size_t) (Argc + 4) * sizeof(SmPropValue));
+ prop1.vals = (SmPropValue *)
+ malloc((size_t) (Argc + 4) * sizeof(SmPropValue));
if (!prop1.vals) {
success = False;