summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOzkan Sezer <sezeroz@gmail.com>2020-10-20 14:56:56 +0300
committerOzkan Sezer <sezeroz@gmail.com>2020-10-20 14:56:56 +0300
commit5b4b1b48fed446aabe7a8d00ec732d482f3c2224 (patch)
tree63ecbcf50f9a4b041149749e490d6932df21ae65
parent281e7687c00c3ea6c23613177de89f8800a282b4 (diff)
downloadsdl-5b4b1b48fed446aabe7a8d00ec732d482f3c2224.tar.gz
video, SDL_os2fslib.c: use calloc instead of malloc where it's suitable
-rw-r--r--src/video/os2fslib/SDL_os2fslib.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/video/os2fslib/SDL_os2fslib.c b/src/video/os2fslib/SDL_os2fslib.c
index ec7005a49..ccc57d62b 100644
--- a/src/video/os2fslib/SDL_os2fslib.c
+++ b/src/video/os2fslib/SDL_os2fslib.c
@@ -1361,15 +1361,13 @@ WMcursor *os2fslib_CreateWMCursor_Win(_THIS, Uint8 *data, Uint8 *mask,
pResult = (WMcursor *) SDL_malloc(sizeof(WMcursor));
if (!pResult) return (WMcursor *) NULL;
- pchTemp = (char *) SDL_malloc((maxx + 7)/8 * maxy*2);
+ pchTemp = (char *) SDL_calloc(1, (maxx + 7)/8 * maxy*2);
if (!pchTemp)
{
SDL_free(pResult);
return (WMcursor *) NULL;
}
- SDL_memset(pchTemp, 0, (maxx + 7)/8 * maxy*2);
-
hps = WinGetPS(_this->hidden->hwndClient);
bmi.bi.cbFix = sizeof(BITMAPINFOHEADER);
@@ -1657,12 +1655,10 @@ void os2fslib_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask)
if ((w>maxx) || (h>maxy))
return;
- pchTemp = (char *) SDL_malloc(w * h*2 * 4);
+ pchTemp = (char *) SDL_calloc(1, w * h*2 * 4);
if (!pchTemp)
return;
- SDL_memset(pchTemp, 0, w * h*2 * 4);
-
// Convert surface to RGB, if it's not RGB yet!
icon_rgb = SDL_CreateRGBSurface(SDL_SWSURFACE, icon->w, icon->h,
32, 0, 0, 0, 0);
@@ -2934,12 +2930,11 @@ static SDL_VideoDevice *os2fslib_CreateDevice(int devindex)
#endif
/* Initialize all variables that we clean on shutdown */
- device = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice));
+ device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice));
if ( device )
{
- SDL_memset(device, 0, (sizeof *device));
// Also allocate memory for private data
- device->hidden = (struct SDL_PrivateVideoData *) SDL_malloc((sizeof(struct SDL_PrivateVideoData)));
+ device->hidden = (struct SDL_PrivateVideoData *) SDL_calloc(1, sizeof(struct SDL_PrivateVideoData));
}
if ( (device == NULL) || (device->hidden == NULL) )
{
@@ -2948,7 +2943,6 @@ static SDL_VideoDevice *os2fslib_CreateDevice(int devindex)
SDL_free(device);
return NULL;
}
- SDL_memset(device->hidden, 0, (sizeof *device->hidden));
/* Set the function pointers */
#ifdef DEBUG_BUILD