ronantakizawa/codereview-bench huggingface dataset:
Repository: libsdl-org/SDL
File: src/joystick/hidapi/SDL_hidapi_gip.c (C)

Code before:
        bytes,
        num_bytes,
        false,
        NULL,
        NULL);
}

static bool GIP_SendVendorMessage(
    GIP_Attachment *attachment,
    Uint8 message_type,
    Uint8 flags,
    const Uint8 *bytes,
    int num_bytes)
{
    return GIP_SendRawMessage(attachment->device,
        message_type,
        flags,
        GIP_SequenceNext(attachment, message_type, false),
        bytes,
        num_bytes,
        true,
        NULL,
        NULL);
}

static bool GIP_AttachmentIsController(GIP_Attachment *attachment) {
    return attachment->attachment_type != GIP_TYPE_CHATPAD;
}

static void GIP_MetadataFree(GIP_Metadata *metadata)
{
    if (metadata->device.audio_formats) {
        SDL_free(metadata->device.audio_formats);
    }
    if (metadata->device.preferred_types) {
        int i;
        for (i = 0; i < metadata->device.num_preferred_types; i++) {
            if (metadata->device.preferred_types[i]) {
                SDL_free(metadata->device.preferred_types[i]);
            }
        }
        SDL_free(metadata->device.preferred_types);
    }
    if (metadata->device.supported_interfaces) {
        SDL_free(metadata->device.supported_interfaces);
    }
    if (metadata->device.hid_descriptor) {
        SDL_free(metadata->device.hid_descriptor);
    }

    if (metadata->message_metadata) {

Review comment (suggestion):
```suggestion
static bool GIP_AttachmentIsController(GIP_Attachment *attachment)
{
```

Code after:
        bytes,
        num_bytes,
        false,
        NULL,
        NULL);
}

static bool GIP_SendVendorMessage(
    GIP_Attachment *attachment,
    Uint8 message_type,
    Uint8 flags,
    const Uint8 *bytes,
    int num_bytes)
{
    return GIP_SendRawMessage(attachment->device,
        message_type,
        flags,
        GIP_SequenceNext(attachment, message_type, false),
        bytes,
        num_bytes,
        true,
        NULL,
        NULL);
}

static bool GIP_AttachmentIsController(GIP_Attachment *attachment)
{
    return attachment->attachment_type != GIP_TYPE_CHATPAD;
}

static void GIP_MetadataFree(GIP_Metadata *metadata)
{
    if (metadata->device.audio_formats) {
        SDL_free(metadata->device.audio_formats);
    }
    if (metadata->device.preferred_types) {
        int i;
        for (i = 0; i < metadata->device.num_preferred_types; i++) {
            if (metadata->device.preferred_types[i]) {
                SDL_free(metadata->device.preferred_types[i]);
            }
        }
        SDL_free(metadata->device.preferred_types);
    }
    if (metadata->device.supported_interfaces) {
        SDL_free(metadata->device.supported_interfaces);
    }
    if (metadata->device.hid_descriptor) {
        SDL_free(metadata->device.hid_descriptor);
    }
Repository: libsdl-org/SDL
File: src/video/windows/SDL_windowsrawinput.c (C)

Code before:
            data->raw_keyboard_enabled = !enabled;
            return false;
        }
    } else {
        if (!WIN_UpdateRawInputEnabled(_this)) {
            data->raw_keyboard_enabled = !enabled;
            return false;
        }
    }
    return true;
}

bool WIN_SetRawKeyboardFlag(SDL_VideoDevice *_this, WIN_RawKeyboardFlag flag, bool enabled)
{
    SDL_VideoData *data = _this->internal;
    if (data->gameinput_context) {
        return false;
    }

    switch(flag) {
        case NOHOTKEYS:
            data->raw_keyboard_flag_nohotkeys = enabled;
            break;
        default:
            return false;
            break;
    }

    return WIN_UpdateRawInputEnabled(_this);
}

#else

bool WIN_SetRawMouseEnabled(SDL_VideoDevice *_this, bool enabled)
{
    return SDL_Unsupported();
}

bool WIN_SetRawKeyboardEnabled(SDL_VideoDevice *_this, bool enabled)
{
    return SDL_Unsupported();
}

bool WIN_SetRawKeyboardFlag(SDL_VideoDevice *_this, WIN_RawKeyboardFlag flag, bool enabled)
{
    return SDL_Unsupported();
}

#endif // !SDL_PLATFORM_XBOXONE && !SDL_PLATFORM_XBOXSERIES

#endif // SDL_VIDEO_DRIVER_WINDOWS

Review comment (suggestion):
```suggestion
```

This break almost tricked me into thinking that `WIN_UpdateRawInputEnabled()` would be called even if the flag was unknown. It's unreachable because of the `return` 🙂.

Code after:
            return false;
        }
    } else {
        if (!WIN_UpdateRawInputEnabled(_this)) {
            data->raw_keyboard_enabled = !enabled;
            return false;
        }
    }
    return true;
}

typedef enum WIN_RawKeyboardFlag {
    NOHOTKEYS
} WIN_RawKeyboardFlag;

static bool WIN_SetRawKeyboardFlag(SDL_VideoDevice *_this, WIN_RawKeyboardFlag flag, bool enabled)
{
    SDL_VideoData *data = _this->internal;

    switch(flag) {
        case NOHOTKEYS:
            data->raw_keyboard_flag_nohotkeys = enabled;
            break;
        default:
            return false;
    }

    if (data->gameinput_context) {
        return true;
    }

    return WIN_UpdateRawInputEnabled(_this);
}

bool WIN_SetRawKeyboardFlag_NoHotkeys(SDL_VideoDevice *_this, bool enabled)
{
    return WIN_SetRawKeyboardFlag(_this, NOHOTKEYS, enabled);
}

#else

bool WIN_SetRawMouseEnabled(SDL_VideoDevice *_this, bool enabled)
{
    return SDL_Unsupported();
}

bool WIN_SetRawKeyboardEnabled(SDL_VideoDevice *_this, bool enabled)
{
    return SDL_Unsupported();
}
Repository: libsdl-org/SDL
File: src/video/windows/SDL_windowsrawinput.h (C/C++)

Code before:
  This software is provided 'as-is', without any express or implied
  warranty.  In no event will the authors be held liable for any damages
  arising from the use of this software.

  Permission is granted to anyone to use this software for any purpose,
  including commercial applications, and to alter it and redistribute it
  freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not
     claim that you wrote the original software. If you use this software
     in a product, an acknowledgment in the product documentation would be
     appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be
     misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.
*/
#include "SDL_internal.h"

#ifndef SDL_windowsrawinput_h_
#define SDL_windowsrawinput_h_

extern bool WIN_SetRawMouseEnabled(SDL_VideoDevice *_this, bool enabled);
extern bool WIN_SetRawKeyboardEnabled(SDL_VideoDevice *_this, bool enabled);

#define WIN_RAWKEYBOARD_FLAG_ENUM_NOHOTKEYS 0
extern bool WIN_SetRawKeyboardFlag(SDL_VideoDevice *_this, Uint32 flag, bool enabled);

#endif // SDL_windowsrawinput_h_


Review comment (suggestion):
The enum made more sense.

I think this should just be:

```suggestion
extern bool WIN_SetRawKeyboardNoHotkeys(SDL_VideoDevice *_this, bool enabled);
```

I think the simplification @slouken mentioned in https://github.com/libsdl-org/SDL/pull/13066#discussion_r2312489413 was removing the enum(same as my suggestion), not making it an integer.

Code after:
  This software is provided 'as-is', without any express or implied
  warranty.  In no event will the authors be held liable for any damages
  arising from the use of this software.

  Permission is granted to anyone to use this software for any purpose,
  including commercial applications, and to alter it and redistribute it
  freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not
     claim that you wrote the original software. If you use this software
     in a product, an acknowledgment in the product documentation would be
     appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be
     misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.
*/
#include "SDL_internal.h"

#ifndef SDL_windowsrawinput_h_
#define SDL_windowsrawinput_h_

extern bool WIN_SetRawMouseEnabled(SDL_VideoDevice *_this, bool enabled);
extern bool WIN_SetRawKeyboardEnabled(SDL_VideoDevice *_this, bool enabled);
extern bool WIN_SetRawKeyboardFlag_NoHotkeys(SDL_VideoDevice *_this, bool enabled);

#endif // SDL_windowsrawinput_h_
Repository: libsdl-org/SDL
File: src/video/windows/SDL_windowsrawinput.c (C)

Code before:
} WIN_RawKeyboardFlag;

static bool WIN_SetRawKeyboardFlag(SDL_VideoDevice *_this, WIN_RawKeyboardFlag flag, bool enabled)
{
    SDL_VideoData *data = _this->internal;
    if (data->gameinput_context) {
        return false;
    }

    switch(flag) {
        case NOHOTKEYS:
            data->raw_keyboard_flag_nohotkeys = enabled;
            break;
        default:
            return false;
    }

    return WIN_UpdateRawInputEnabled(_this);
}

bool WIN_SetRawKeyboardFlag_NoHotkeys(SDL_VideoDevice *_this, bool enabled)
{
    return WIN_SetRawKeyboardFlag(_this, NOHOTKEYS, enabled);
}

#else

bool WIN_SetRawMouseEnabled(SDL_VideoDevice *_this, bool enabled)
{
    return SDL_Unsupported();
}

bool WIN_SetRawKeyboardEnabled(SDL_VideoDevice *_this, bool enabled)
{
    return SDL_Unsupported();
}

bool WIN_SetRawKeyboardFlag_NoHotkeys(SDL_VideoDevice *_this, bool enabled)
{
    return SDL_Unsupported();
}

#endif // !SDL_PLATFORM_XBOXONE && !SDL_PLATFORM_XBOXSERIES

#endif // SDL_VIDEO_DRIVER_WINDOWS


Review comment (suggestion):
This seems unnecessary. Any reason not to just inline it like this?

```suggestion
bool WIN_SetRawKeyboardFlag_NoHotkeys(SDL_VideoDevice *_this, bool enabled)
{
    SDL_VideoData *data = _this->internal;
    XXX: Is this even necessary? Do we read raw_keyboard_flag_nohotkeys if gameinput_context is used?
    if (data->gameinput_context) {
        return false;
    }
    
    data->raw_keyboard_flag_nohotkeys = enabled;
    return true;
}

```

Code after:
} WIN_RawKeyboardFlag;

static bool WIN_SetRawKeyboardFlag(SDL_VideoDevice *_this, WIN_RawKeyboardFlag flag, bool enabled)
{
    SDL_VideoData *data = _this->internal;

    switch(flag) {
        case NOHOTKEYS:
            data->raw_keyboard_flag_nohotkeys = enabled;
            break;
        default:
            return false;
    }

    if (data->gameinput_context) {
        return true;
    }

    return WIN_UpdateRawInputEnabled(_this);
}

bool WIN_SetRawKeyboardFlag_NoHotkeys(SDL_VideoDevice *_this, bool enabled)
{
    return WIN_SetRawKeyboardFlag(_this, NOHOTKEYS, enabled);
}

#else

bool WIN_SetRawMouseEnabled(SDL_VideoDevice *_this, bool enabled)
{
    return SDL_Unsupported();
}

bool WIN_SetRawKeyboardEnabled(SDL_VideoDevice *_this, bool enabled)
{
    return SDL_Unsupported();
}

bool WIN_SetRawKeyboardFlag_NoHotkeys(SDL_VideoDevice *_this, bool enabled)
{
    return SDL_Unsupported();
}

#endif // !SDL_PLATFORM_XBOXONE && !SDL_PLATFORM_XBOXSERIES

#endif // SDL_VIDEO_DRIVER_WINDOWS
Repository: libsdl-org/SDL
File: src/video/x11/SDL_x11dyn.c (C)

Code before:
#ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS
#define SDL_X11_DYNAMIC_XSS_APPEND ,SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS
#else
#define SDL_X11_DYNAMIC_XSS_APPEND
#endif

#ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC_XTEST
#define SDL_X11_DYNAMIC_XTEST_APPEND ,SDL_VIDEO_DRIVER_X11_DYNAMIC_XTEST
#else
#define SDL_X11_DYNAMIC_XTEST_APPEND
#endif

#define SDL_X11_DYNAMIC_LIBS \
    SDL_VIDEO_DRIVER_X11_DYNAMIC \
    SDL_X11_DYNAMIC_XEXT_APPEND \
    SDL_X11_DYNAMIC_XCURSOR_APPEND \
    SDL_X11_DYNAMIC_XINPUT2_APPEND \
    SDL_X11_DYNAMIC_XFIXES_APPEND \
    SDL_X11_DYNAMIC_XRANDR_APPEND \
    SDL_X11_DYNAMIC_XSS_APPEND \
    SDL_X11_DYNAMIC_XTEST_APPEND

SDL_ELF_NOTE_DLOPEN(
    "x11",
    "Support for video through X11 backend",
    SDL_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED,
    SDL_X11_DYNAMIC_LIBS
);

static const char *x11libnames[] = {
    SDL_X11_DYNAMIC_LIBS
};

static SDL_SharedObject *x11libs[SDL_arraysize(x11libnames)];

static void *X11_GetSym(const char *fnname, int *pHasModule)
{
    int i;
    void *fn = NULL;
    for (i = 0; i < SDL_arraysize(x11libs); i++) {
        if (x11libs[i]) {
            fn = SDL_LoadFunction(x11libs[i], fnname);
            if (fn) {
                break;
            }
        }
    }

#if DEBUG_DYNAMIC_X11
    if (fn)
        printf("X11: Found '%s' in %s (%p)\n", fnname, x11libnames[i], fn);

Review comment (suggestion):
I think these should be `RECOMMENDED`. You don't strictly need X11 libraries if you are actually running on native Wayland, and if packagers are OK with having a hard dependency then they can turn off `SDL_VIDEO_DRIVER_X11_DYNAMIC` (as we do in Debian).

Code after:
);
#else
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR NULL
#endif

#ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2
SDL_ELF_NOTE_DLOPEN(
    "x11",
    "Support for video through X11 backend",
    SDL_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED,
    SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2
);
#else
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 NULL
#endif

#ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES
SDL_ELF_NOTE_DLOPEN(
    "x11",
    "Support for video through X11 backend",
    SDL_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED,
    SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES
);
#else
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES NULL
#endif

#ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR
SDL_ELF_NOTE_DLOPEN(
    "x11",
    "Support for video through X11 backend",
    SDL_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED,
    SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR
);
#else
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR NULL
#endif

#ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS
SDL_ELF_NOTE_DLOPEN(
    "x11",
    "Support for video through X11 backend",
    SDL_ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED,
    SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS
);
#else
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS NULL
#endif

#ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC_XTEST
SDL_ELF_NOTE_DLOPEN(
Repository: libsdl-org/SDL
File: src/video/wayland/SDL_waylanddyn.c (C)

Code before:

#ifdef SDL_VIDEO_DRIVER_WAYLAND

#define DEBUG_DYNAMIC_WAYLAND 0

#include "SDL_waylanddyn.h"

#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC

SDL_ELF_NOTE_DLOPEN(
    "wayland",
    "Support for Wayland video",
    SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
    SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
);
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL
SDL_ELF_NOTE_DLOPEN(
    "wayland-egl",
    "Support for Wayland video",
    SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
    SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL
);
#endif
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR
SDL_ELF_NOTE_DLOPEN(
    "wayland-cursor",
    "Support for Wayland video",
    SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
    SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR
);
#endif
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
SDL_ELF_NOTE_DLOPEN(
    "wayland-xkbcommon",
    "Support for Wayland video",
    SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
    SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
);
#endif
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR
SDL_ELF_NOTE_DLOPEN(
    "wayland-libdecor",
    "Support for Wayland video",
    SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
    SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR
);
#endif

typedef struct
{
    SDL_SharedObject *lib;

Review comment (suggestion):
Should these (and the rest of the Wayland libraries) all be grouped as a `"wayland"` topic? (the `AND` pattern, similar to `"x11"`)

Code after:

#ifdef SDL_VIDEO_DRIVER_WAYLAND

#define DEBUG_DYNAMIC_WAYLAND 0

#include "SDL_waylanddyn.h"

#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC

SDL_ELF_NOTE_DLOPEN(
    "wayland",
    "Support for Wayland video",
    SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
    SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
);
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL
SDL_ELF_NOTE_DLOPEN(
    "wayland",
    "Support for Wayland video",
    SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
    SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL
);
#endif
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR
SDL_ELF_NOTE_DLOPEN(
    "wayland",
    "Support for Wayland video",
    SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
    SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR
);
#endif
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
SDL_ELF_NOTE_DLOPEN(
    "wayland",
    "Support for Wayland video",
    SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
    SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
);
#endif
#ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR
SDL_ELF_NOTE_DLOPEN(
    "wayland",
    "Support for Wayland video",
    SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
    SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR
);
#endif

typedef struct
{
    SDL_SharedObject *lib;
Repository: libsdl-org/SDL
File: src/video/x11/SDL_x11vulkan.c (C)

Code before:

#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_X11)

#include "../SDL_vulkan_internal.h"

#include "SDL_x11video.h"

#include "SDL_x11vulkan.h"

#include <X11/Xlib.h>
// #include <xcb/xcb.h>

#ifdef SDL_PLATFORM_OPENBSD
#define DEFAULT_VULKAN "libvulkan.so"
#define DEFAULT_X11_XCB "libX11-xcb.so"
#else
#define DEFAULT_VULKAN "libvulkan.so.1"
#define DEFAULT_X11_XCB "libX11-xcb.so.1"
#endif

SDL_ELF_NOTE_DLOPEN(
    "x11-vulkan",
    "Support for vulkan on X11",
    SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
    DEFAULT_VULKAN, DEFAULT_X11_XCB
);

/*
typedef uint32_t xcb_window_t;
typedef uint32_t xcb_visualid_t;
*/

bool X11_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path)
{
    SDL_VideoData *videoData = _this->internal;
    VkExtensionProperties *extensions = NULL;
    Uint32 extensionCount = 0;
    bool hasSurfaceExtension = false;
    bool hasXlibSurfaceExtension = false;
    bool hasXCBSurfaceExtension = false;
    PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL;
    Uint32 i;
    if (_this->vulkan_config.loader_handle) {
        return SDL_SetError("Vulkan already loaded");
    }

    // Load the Vulkan loader library
    if (!path) {
        path = SDL_GetHint(SDL_HINT_VULKAN_LIBRARY);
    }
    if (!path) {

Review comment (suggestion):
This should maybe be two records both labelled `"x11-vulkan"`, one for `libvulkan` and one for `libX11-xcb`? because this is an `AND`, but as implemented here I think it's declared as an `OR`.

Code after:

#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_X11)

#include "../SDL_vulkan_internal.h"

#include "SDL_x11video.h"

#include "SDL_x11vulkan.h"

#include <X11/Xlib.h>
// #include <xcb/xcb.h>

#ifdef SDL_PLATFORM_OPENBSD
#define DEFAULT_VULKAN "libvulkan.so"
#define DEFAULT_X11_XCB "libX11-xcb.so"
#else
#define DEFAULT_VULKAN "libvulkan.so.1"
#define DEFAULT_X11_XCB "libX11-xcb.so.1"
#endif

SDL_ELF_NOTE_DLOPEN(
    "x11-vulkan",
    "Support for vulkan on X11",
    SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
    DEFAULT_VULKAN
);

SDL_ELF_NOTE_DLOPEN(
    "x11-vulkan",
    "Support for vulkan on X11",
    SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
    DEFAULT_X11_XCB
);

/*
typedef uint32_t xcb_window_t;
typedef uint32_t xcb_visualid_t;
*/

bool X11_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path)
{
    SDL_VideoData *videoData = _this->internal;
    VkExtensionProperties *extensions = NULL;
    Uint32 extensionCount = 0;
    bool hasSurfaceExtension = false;
    bool hasXlibSurfaceExtension = false;
    bool hasXCBSurfaceExtension = false;
    PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL;
    Uint32 i;
    if (_this->vulkan_config.loader_handle) {
        return SDL_SetError("Vulkan already loaded");
Repository: libsdl-org/SDL
File: include/SDL3/SDL_begin_code.h (C/C++)

Code before:
#else
#define SDL_ALLOC_SIZE(p)
#endif
#endif /* SDL_ALLOC_SIZE not defined */

#ifndef SDL_ALLOC_SIZE2
#if (defined(__clang__) && __clang_major__ >= 4) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
#define SDL_ALLOC_SIZE2(p1, p2) __attribute__((alloc_size(p1, p2)))
#elif defined(_MSC_VER)
#define SDL_ALLOC_SIZE2(p1, p2)
#else
#define SDL_ALLOC_SIZE2(p1, p2)
#endif
#endif /* SDL_ALLOC_SIZE2 not defined */

#ifndef SDL_ALIGNED
#if defined(__clang__) || defined(__GNUC__)
#define SDL_ALIGNED(x) __attribute__((aligned(x)))
#elif defined(_MSC_VER)
#define SDL_ALIGNED(x) __declspec(align(x))
#elif defined(__cplusplus) && (__cplusplus >= 201103L)
#define SDL_ALIGNED(x) alignas(x)
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
#define SDL_ALIGNED(x) _Alignas(x)
#else
#define SDL_ALIGNED(x) SDL_ALIGNED_is_not_supported_by_this_compiler___THIS_IS_A_SERIOUS_PROBLEM
#endif
#endif /* SDL_ALIGNED not defined */



Review comment (suggestion):
```suggestion
#define SDL_ALIGNED(x) PLEASE_DEFINE_SDL_ALIGNED
```

Code after:
#else
#define SDL_ALLOC_SIZE(p)
#endif
#endif /* SDL_ALLOC_SIZE not defined */

#ifndef SDL_ALLOC_SIZE2
#if (defined(__clang__) && __clang_major__ >= 4) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
#define SDL_ALLOC_SIZE2(p1, p2) __attribute__((alloc_size(p1, p2)))
#elif defined(_MSC_VER)
#define SDL_ALLOC_SIZE2(p1, p2)
#else
#define SDL_ALLOC_SIZE2(p1, p2)
#endif
#endif /* SDL_ALLOC_SIZE2 not defined */

#ifndef SDL_ALIGNED
#if defined(__clang__) || defined(__GNUC__)
#define SDL_ALIGNED(x) __attribute__((aligned(x)))
#elif defined(_MSC_VER)
#define SDL_ALIGNED(x) __declspec(align(x))
#elif defined(__cplusplus) && (__cplusplus >= 201103L)
#define SDL_ALIGNED(x) alignas(x)
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
#define SDL_ALIGNED(x) _Alignas(x)
#else
#define SDL_ALIGNED(x) PLEASE_DEFINE_SDL_ALIGNED
#endif
#endif /* SDL_ALIGNED not defined */
Repository: libsdl-org/SDL
File: src/tray/windows/SDL_tray.c (C)

Code before:
{
    HINSTANCE hInstance = GetModuleHandle(NULL);
    if (!hInstance) {
        return LoadIcon(NULL, IDI_APPLICATION);
    }

    const char *hint = SDL_GetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL);
    if (hint && *hint) {
        HICON icon = LoadIcon(hInstance, MAKEINTRESOURCE(SDL_atoi(hint)));
        return icon ? icon : LoadIcon(NULL, IDI_APPLICATION);
    }

    hint = SDL_GetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON);
    if (hint && *hint) {
        HICON icon = LoadIcon(hInstance, MAKEINTRESOURCE(SDL_atoi(hint)));
        return icon ? icon : LoadIcon(NULL, IDI_APPLICATION);
    }

    return LoadIcon(NULL, IDI_APPLICATION);
}

void SDL_UpdateTrays(void)
{
}

static void SDL_PropTrayCleanupCb(void* userdata, void* cls) {
    WNDCLASSEX wcex;

    wcex.hIcon = NULL;
    wcex.hIconSm = NULL;
    HINSTANCE h = GetModuleHandle(NULL);
    if (GetClassInfoEx(h, cls, &wcex)) {
        UnregisterClass(cls, h);
    }
}

static bool SDL_RegisterTrayClass(LPCWSTR className)
{
    SDL_PropertiesID g = SDL_GetGlobalProperties();
    if (!g) {
        return false;
    }
    void* p = SDL_GetPointerProperty(g, SDL_PROP_TRAY_CLEANUP, NULL);
    if (p) {
        return true;
    }

    WNDCLASSEX wcex;

    wcex.cbSize = sizeof(WNDCLASSEX);
    wcex.hCursor = NULL;

Review comment (suggestion):
```suggestion
static void SDL_PropTrayCleanupCb(void *userdata, void *cls)
{
```

Code after:
{
    HINSTANCE hInstance = GetModuleHandle(NULL);
    if (!hInstance) {
        return LoadIcon(NULL, IDI_APPLICATION);
    }

    const char *hint = SDL_GetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL);
    if (hint && *hint) {
        HICON icon = LoadIcon(hInstance, MAKEINTRESOURCE(SDL_atoi(hint)));
        return icon ? icon : LoadIcon(NULL, IDI_APPLICATION);
    }

    hint = SDL_GetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON);
    if (hint && *hint) {
        HICON icon = LoadIcon(hInstance, MAKEINTRESOURCE(SDL_atoi(hint)));
        return icon ? icon : LoadIcon(NULL, IDI_APPLICATION);
    }

    return LoadIcon(NULL, IDI_APPLICATION);
}

void SDL_UpdateTrays(void)
{
}

static void SDL_PropTrayCleanupCb(void *userdata, void *cls)
{
    WNDCLASSEX wcex;

    wcex.hIcon = NULL;
    wcex.hIconSm = NULL;
    HINSTANCE h = GetModuleHandle(NULL);
    if (GetClassInfoEx(h, cls, &wcex)) {
        UnregisterClass(cls, h);
    }
}

static bool SDL_RegisterTrayClass(LPCWSTR className)
{
    SDL_PropertiesID props = SDL_GetGlobalProperties();
    if (!props) {
        return false;
    }
    if (SDL_GetPointerProperty(props, SDL_PROP_TRAY_CLEANUP, NULL) != NULL) {
        return true;
    }

    WNDCLASSEX wcex;

    wcex.cbSize = sizeof(WNDCLASSEX);
    wcex.hCursor = NULL;