Просмотр исходного кода

DOS: Replace SDL_memset() with SDL_zero*()

Eddy Jansson 5 дней назад
Родитель
Сommit
4eb221881a

+ 2 - 2
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;

+ 2 - 2
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 */

+ 2 - 2
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;
             }

+ 2 - 2
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;