This code would be more efficient if it didn't call strlen() before the loop, and instead had something along the lines of (untested!)

    bool quote = false;
    while (true)
    {
         char next = *str;
         if (next == '\0')
             return NULL;
        if ('"' == next)
        {
            quote = !quote;
        }
        else if (c == next && !quote)
            return str;
        ++str;
    }