/* grab the name string from a mapping string  */
static char* SDL_PrivateGetControllerNameFromMappingString(const char *pMapping)
/* grab the name string from a mapping string  */
static char* SDL_PrivateGetControllerNameFromMappingString(const char *pMapping)
{
    const char *pFirstComma, *pSecondComma;
    char *pchName;
    pFirstComma = SDL_strchr(pMapping, ',');
    if (!pFirstComma)
        return NULL;
    pSecondComma = SDL_strchr(pFirstComma + 1, ',');
    if (!pSecondComma)
        return NULL;
    pchName = SDL_malloc(pSecondComma - pFirstComma);
    if (!pchName) {
        SDL_OutOfMemory();
        return NULL;
    }
    SDL_memcpy(pchName, pFirstComma + 1, pSecondComma - pFirstComma);
    pchName[pSecondComma - pFirstComma - 1] = 0;
    return pchName;
}