[REVIEW] redundantAssignInSwitch in connectivity/source/drivers/postgresql/pq_tools.cxx

julien2412 serval2412 at yahoo.fr
Sat Mar 3 14:46:18 PST 2012


Hello,

Cppcheck reports this :
core/connectivity/source/drivers/postgresql/pq_tools.cxx
520	redundantAssignInSwitch	style	Redundant assignment of "ret" in switch

Here's the function :
static bool isOperator( char c )
{
    bool ret;
    switch(c)
    {
    case '+':
    case '-':
    case '*':
    case '/':
    case '<':
    case '>':
    case '=':
    case '~':
    case '!':
    case '@':
    case '#':
    case '%':
    case '^':
    case '&':
    case '|':
    case '`':
    case '?':
    case '$':
        ret = true;<--- Redundant assignment of "ret" in switch
    default:
        ret = false;
    }
    return ret;
}

I just added a break after true assignment (cf commit
4a8710409fbf69fb4c3e175c1a17d72ea06576ef)

Would it be ok to cherry-pick for 3.5 ?

Julien.


--
View this message in context: http://nabble.documentfoundation.org/REVIEW-redundantAssignInSwitch-in-connectivity-source-drivers-postgresql-pq-tools-cxx-tp3796908p3796908.html
Sent from the Dev mailing list archive at Nabble.com.


More information about the LibreOffice mailing list