mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-07-17 14:31:10 +00:00
Prefer SDL_zero()/SDL_zerop()
Replace uses of 'SDL_memset(E, 0, sizeof(E))' and similar with the SDL_zero()/SDL_zerop() macros.
This commit is contained in:
committed by
Sam Lantinga
parent
fe403220f0
commit
83fb7b6636
@@ -79,7 +79,7 @@ bool VITA_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, SD
|
||||
// SDL_memset the buffer to black
|
||||
SDL_memset(data->buffer, 0x0, SCREEN_W * SCREEN_H * 4);
|
||||
|
||||
SDL_memset(&framebuf, 0x00, sizeof(SceDisplayFrameBuf));
|
||||
SDL_zero(framebuf);
|
||||
framebuf.size = sizeof(SceDisplayFrameBuf);
|
||||
framebuf.base = data->buffer;
|
||||
framebuf.pitch = SCREEN_W;
|
||||
|
||||
@@ -387,7 +387,7 @@ void VITA_ImeEventHandler(void *arg, const SceImeEventData *e)
|
||||
} else {
|
||||
SDL_SendKeyboardText((const char *)utf8_buffer);
|
||||
}
|
||||
SDL_memset(&caret_rev, 0, sizeof(SceImeCaret));
|
||||
SDL_zero(caret_rev);
|
||||
SDL_memset(libime_out, 0, ((SCE_IME_MAX_PREEDIT_LENGTH + SCE_IME_MAX_TEXT_LENGTH + 1) * sizeof(SceWChar16)));
|
||||
caret_rev.index = 1;
|
||||
sceImeSetCaret(&caret_rev);
|
||||
@@ -553,7 +553,7 @@ void VITA_PumpEvents(SDL_VideoDevice *_this)
|
||||
uint8_t utf8_buffer[SCE_IME_DIALOG_MAX_TEXT_LENGTH];
|
||||
|
||||
SceImeDialogResult result;
|
||||
SDL_memset(&result, 0, sizeof(SceImeDialogResult));
|
||||
SDL_zero(result);
|
||||
sceImeDialogGetResult(&result);
|
||||
|
||||
// Convert UTF16 to UTF8
|
||||
|
||||
@@ -64,7 +64,7 @@ static int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct times
|
||||
if (sigismember(set, signo) && sigismember(&pending, signo)) {
|
||||
if (!sigwait(set, &signo)) {
|
||||
if (info) {
|
||||
SDL_memset(info, 0, sizeof *info);
|
||||
SDL_zerop(info);
|
||||
info->si_signo = signo;
|
||||
}
|
||||
return signo;
|
||||
|
||||
@@ -2522,7 +2522,7 @@ static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat, enum w
|
||||
|
||||
if ((capabilities & WL_SEAT_CAPABILITY_POINTER) && !seat->pointer.wl_pointer) {
|
||||
seat->pointer.wl_pointer = wl_seat_get_pointer(wl_seat);
|
||||
SDL_memset(&seat->pointer.pending_frame.axis, 0, sizeof(seat->pointer.pending_frame.axis));
|
||||
SDL_zero(seat->pointer.pending_frame.axis);
|
||||
|
||||
Wayland_SeatCreateCursorShape(seat);
|
||||
|
||||
|
||||
@@ -1731,7 +1731,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
|
||||
}
|
||||
|
||||
// reply with status
|
||||
SDL_memset(&m, 0, sizeof(XClientMessageEvent));
|
||||
SDL_zero(m);
|
||||
m.type = ClientMessage;
|
||||
m.display = xevent->xclient.display;
|
||||
m.window = xevent->xclient.data.l[0];
|
||||
@@ -1748,7 +1748,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
|
||||
} else if (xevent->xclient.message_type == videodata->atoms.XdndDrop) {
|
||||
if (data->xdnd_req == None) {
|
||||
// say again - not interested!
|
||||
SDL_memset(&m, 0, sizeof(XClientMessageEvent));
|
||||
SDL_zero(m);
|
||||
m.type = ClientMessage;
|
||||
m.display = xevent->xclient.display;
|
||||
m.window = xevent->xclient.data.l[0];
|
||||
@@ -2175,7 +2175,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
|
||||
X11_XFree(p.data);
|
||||
|
||||
// send reply
|
||||
SDL_memset(&m, 0, sizeof(XClientMessageEvent));
|
||||
SDL_zero(m);
|
||||
m.type = ClientMessage;
|
||||
m.display = display;
|
||||
m.window = data->xdnd_source;
|
||||
@@ -2243,7 +2243,7 @@ void X11_SendWakeupEvent(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
Window xwindow = window->internal->xwindow;
|
||||
XClientMessageEvent event;
|
||||
|
||||
SDL_memset(&event, 0, sizeof(XClientMessageEvent));
|
||||
SDL_zero(event);
|
||||
event.type = ClientMessage;
|
||||
event.display = req_display;
|
||||
event.send_event = True;
|
||||
|
||||
@@ -354,7 +354,7 @@ SDL_WindowFlags X11_GetNetWMState(SDL_VideoDevice *_this, SDL_Window *window, Wi
|
||||
*/
|
||||
{
|
||||
XWindowAttributes attr;
|
||||
SDL_memset(&attr, 0, sizeof(attr));
|
||||
SDL_zero(attr);
|
||||
X11_XGetWindowAttributes(videodata->display, xwindow, &attr);
|
||||
if (attr.map_state == IsUnmapped) {
|
||||
flags |= SDL_WINDOW_HIDDEN;
|
||||
|
||||
Reference in New Issue
Block a user