Repository: libsdl-org/SDL
File: src/joystick/SDL_gamepad.c (C)

Code before:
            if (SDL_PrivateGetGamepadMapping(instance_id, true) != NULL) {
                result = true;
            } else {
                result = false;
            }
            if (!s_gamepadInstanceIDs) {
                s_gamepadInstanceIDs = SDL_CreateHashTable(0, false, SDL_HashID, SDL_KeyMatchID, NULL, NULL);
            }
            if (s_gamepadInstanceIDs) {
                SDL_InsertIntoHashTable(s_gamepadInstanceIDs, (void *)(uintptr_t)instance_id, (void *)(uintptr_t)result, true);
            }
        }
    }
    SDL_UnlockJoysticks();

    return result;
}

/*
 * Return 1 if the gamepad should be ignored by SDL
 */
bool SDL_ShouldIgnoreGamepad(Uint16 vendor_id, Uint16 product_id, Uint16 version, const char *name)
{
    int i;
    for (i = 0; i < SDL_arraysize(SDL_gamepad_blacklist_words); i++) {
        struct SDL_GamepadBlacklistWords blacklist_word = SDL_gamepad_blacklist_words[i];

        if ((blacklist_word.pos == GAMEPAD_BLACKLIST_BEGIN && SDL_startswith(name, blacklist_word.str))
            || (blacklist_word.pos == GAMEPAD_BLACKLIST_END && SDL_endswith(name, blacklist_word.str))
            || (blacklist_word.pos == GAMEPAD_BLACKLIST_ANYWHERE && SDL_strstr(name, blacklist_word.str) != NULL)) {
            return true;
        }
    }

#ifdef SDL_PLATFORM_WIN32
    if (SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", false) &&
        SDL_GetHintBoolean("STEAM_COMPAT_PROTON", false)) {
        // We are launched by Steam and running under Proton
        // We can't tell whether this controller is a Steam Virtual Gamepad,
        // so assume that Proton is doing the appropriate filtering of controllers
        // and anything we see here is fine to use.
        return false;
    }
#endif // SDL_PLATFORM_WIN32

    if (SDL_IsJoystickSteamVirtualGamepad(vendor_id, product_id, version)) {
        return !SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", false);
    }

    if (SDL_allowed_gamepads.num_included_entries > 0) {
        if (SDL_VIDPIDInList(vendor_id, product_id, &SDL_allowed_gamepads)) {

Review comment (suggestion):
```suggestion
        const struct SDL_GamepadBlacklistWords *blacklist_word = &SDL_gamepad_blacklist_words[i];
```
This avoids a copy.
This suggestion is also incomplete: you need use `->` instead below.

Code after:
            if (SDL_PrivateGetGamepadMapping(instance_id, true) != NULL) {
                result = true;
            } else {
                result = false;
            }
            if (!s_gamepadInstanceIDs) {
                s_gamepadInstanceIDs = SDL_CreateHashTable(0, false, SDL_HashID, SDL_KeyMatchID, NULL, NULL);
            }
            if (s_gamepadInstanceIDs) {
                SDL_InsertIntoHashTable(s_gamepadInstanceIDs, (void *)(uintptr_t)instance_id, (void *)(uintptr_t)result, true);
            }
        }
    }
    SDL_UnlockJoysticks();

    return result;
}

/*
 * Return 1 if the gamepad should be ignored by SDL
 */
bool SDL_ShouldIgnoreGamepad(Uint16 vendor_id, Uint16 product_id, Uint16 version, const char *name)
{
    int i;
    for (i = 0; i < SDL_arraysize(SDL_gamepad_blacklist_words); i++) {
        const struct SDL_GamepadBlacklistWords *blacklist_word = &SDL_gamepad_blacklist_words[i];

        switch (blacklist_word->pos) {
            case GAMEPAD_BLACKLIST_BEGIN:
                if (SDL_startswith(name, blacklist_word->str)) {
                    return true;
                }
                break;
            
            case GAMEPAD_BLACKLIST_END:
                if (SDL_endswith(name, blacklist_word->str)) {
                    return true;
                }
                break;

            case GAMEPAD_BLACKLIST_ANYWHERE:
                if (SDL_strstr(name, blacklist_word->str) != NULL) {
                    return true;
                }
                break;
        }
    }

#ifdef SDL_PLATFORM_WIN32
    if (SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", false) &&
        SDL_GetHintBoolean("STEAM_COMPAT_PROTON", false)) {