diff options
author | Tim Wiederhake <twied@gmx.net> | 2023-12-30 20:49:48 +0100 |
---|---|---|
committer | Tim Wiederhake <twied@gmx.net> | 2024-01-21 13:14:37 +0100 |
commit | 365a94b62df6144ad016e587f3756d974b6e2018 (patch) | |
tree | 08182cf099e612ba7830c929375c56c06035368a /src/util.c | |
parent | 7fe0acdb259c7dd9f3b6214ba16f272da81beadb (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/util.c')
-rw-r--r-- | src/util.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -259,7 +259,7 @@ ExpandFilename(const char *name) if (name[0] != '~') return strdup(name); - newname = malloc((size_t) HomeLen + strlen(name) + 2); + newname = (char *) malloc((size_t) HomeLen + strlen(name) + 2); if (!newname) { twmWarning("unable to allocate %lu bytes to expand filename %s/%s", (unsigned long) HomeLen + (unsigned long) strlen(name) + 2, @@ -358,7 +358,8 @@ FindBitmap(const char *name, unsigned *widthp, unsigned *heightp) /* * Attempt to find icon in old IconDirectory (now obsolete) */ - bigname = malloc(strlen(name) + strlen(Scr->IconDirectory) + 2); + bigname = (char *) + malloc(strlen(name) + strlen(Scr->IconDirectory) + 2); if (!bigname) { twmWarning("unable to allocate memory for \"%s/%s\"", Scr->IconDirectory, name); @@ -399,7 +400,7 @@ InsertRGBColormap(Atom a, XStandardColormap *maps, int nmaps, Bool replace) } if (!sc) { /* no existing, allocate new */ - sc = malloc(sizeof(StdCmap)); + sc = (StdCmap *) malloc(sizeof(StdCmap)); if (!sc) { twmWarning("unable to allocate %lu bytes for StdCmap", (unsigned long) sizeof(StdCmap)); |