From 4eb221881a3d51eae8aa42d1ced97bb994917325 Mon Sep 17 00:00:00 2001
From: Eddy Jansson <[EMAIL REDACTED]>
Date: Wed, 13 May 2026 18:10:50 +0200
Subject: [PATCH] DOS: Replace SDL_memset() with SDL_zero*()
---
src/core/dos/SDL_dos_scheduler.c | 4 ++--
src/thread/dos/SDL_systls.c | 4 ++--
src/video/dos/SDL_dosframebuffer.c | 4 ++--
src/video/dos/SDL_dosmodes.c | 4 ++--
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/core/dos/SDL_dos_scheduler.c b/src/core/dos/SDL_dos_scheduler.c
index 9c0163ce12165..6800b7a17eec4 100644
--- a/src/core/dos/SDL_dos_scheduler.c
+++ b/src/core/dos/SDL_dos_scheduler.c
@@ -82,7 +82,7 @@ void DOS_SchedulerInit(void)
return;
}
- SDL_memset(threads, 0, sizeof(threads));
+ SDL_zeroa(threads);
// Thread 0 is the main thread (already running)
threads[0].state = DOS_THREAD_RUNNING;
@@ -146,7 +146,7 @@ int DOS_CreateThread(int (*fn)(void *), void *arg, size_t stack_size)
_go32_dpmi_lock_data(stack, stack_size);
DOS_ThreadContext *ctx = &threads[tid];
- SDL_memset(ctx, 0, sizeof(*ctx));
+ SDL_zerop(ctx);
ctx->id = tid;
ctx->state = DOS_THREAD_READY;
ctx->stack_base = stack;
diff --git a/src/thread/dos/SDL_systls.c b/src/thread/dos/SDL_systls.c
index da9406f0a9882..86220de3566dc 100644
--- a/src/thread/dos/SDL_systls.c
+++ b/src/thread/dos/SDL_systls.c
@@ -34,7 +34,7 @@ static SDL_TLSData *tls_data[DOS_MAX_THREADS];
void SDL_SYS_InitTLSData(void)
{
- SDL_memset(tls_data, 0, sizeof(tls_data));
+ SDL_zeroa(tls_data);
}
SDL_TLSData *SDL_SYS_GetTLSData(void)
@@ -58,7 +58,7 @@ bool SDL_SYS_SetTLSData(SDL_TLSData *data)
void SDL_SYS_QuitTLSData(void)
{
- SDL_memset(tls_data, 0, sizeof(tls_data));
+ SDL_zeroa(tls_data);
}
#endif /* SDL_THREAD_DOS */
diff --git a/src/video/dos/SDL_dosframebuffer.c b/src/video/dos/SDL_dosframebuffer.c
index 2a707c9526a6f..85d6992d933a4 100644
--- a/src/video/dos/SDL_dosframebuffer.c
+++ b/src/video/dos/SDL_dosframebuffer.c
@@ -105,7 +105,7 @@ static SDL_Surface *GetConvertedCursorSurface(SDL_CursorData *curdata, SDL_Surfa
// Track which palette indices are used by opaque pixels.
bool used[256];
- SDL_memset(used, 0, sizeof(used));
+ SDL_zeroa(used);
// First pass: blit with BLENDMODE_NONE to get raw color-matched indices.
SDL_SetSurfaceBlendMode(src, SDL_BLENDMODE_NONE);
@@ -181,7 +181,7 @@ static SDL_Surface *CreateSystemSurface(SDL_VideoData *data, int w, int h, SDL_P
// Initialize palette to all-black so that transitions start
// from black instead of flashing uninitialized (white) colors.
SDL_Color black[256];
- SDL_memset(black, 0, sizeof(black));
+ SDL_zeroa(black);
for (int i = 0; i < 256; i++) {
black[i].a = SDL_ALPHA_OPAQUE;
}
diff --git a/src/video/dos/SDL_dosmodes.c b/src/video/dos/SDL_dosmodes.c
index 2976caf8c9c02..2f9962ec13a70 100644
--- a/src/video/dos/SDL_dosmodes.c
+++ b/src/video/dos/SDL_dosmodes.c
@@ -529,7 +529,7 @@ bool DOSVESA_SetDisplayMode(SDL_VideoDevice *device, SDL_VideoDisplay *sdl_displ
// Clear the framebuffer
{
Uint8 zero_buf[320];
- SDL_memset(zero_buf, 0, sizeof(zero_buf));
+ SDL_zeroa(zero_buf);
Uint32 vga_base = (Uint32)VGA_MODE_13H_SEGMENT << 4;
for (int row = 0; row < 200; row++) {
dosmemput(zero_buf, 320, vga_base + row * 320);
@@ -590,7 +590,7 @@ bool DOSVESA_SetDisplayMode(SDL_VideoDevice *device, SDL_VideoDisplay *sdl_displ
Uint32 win_size_bytes = (Uint32)modedata->win_size * 1024;
Uint32 win_base = (Uint32)modedata->win_a_segment << 4;
Uint8 zero_buf[1024];
- SDL_memset(zero_buf, 0, sizeof(zero_buf));
+ SDL_zeroa(zero_buf);
Uint32 offset = 0;
int current_bank = -1;