! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
icon_bar.c:1385: possible bad if test ?
Status:
RESOLVED: FIXED
Product:
Ristretto
Component:
General

Comments

Description David Binderman 2013-12-09 20:16:54 CET
Static analysis tool cppcheck said many things, including

[icon_bar.c:1385] -> [icon_bar.c:1385]: (style) Same expression on both sides of '&&'.

Source code is

    if (G_LIKELY (item->width != -1 && item->width != -1))
        return;

Maybe

     if (G_LIKELY (item->width != -1 && item->height != -1))
        return;

was intended.
Comment 1 Eric Koegel editbugs 2014-04-07 11:33:45 CEST
Created attachment 5421 
Don't check item->width twice

Indeed there's no need to check item->width twice on the same line.
Checking for item->height isn't needed because the function never
uses item->height but does set it at the end.
Comment 2 Eric Koegel editbugs 2015-01-18 09:28:58 CET
Pushed to master in:

commit 0afa544fd7e9ca3d589c4d2a9f0ef01a64f4816c
Author: Eric Koegel <eric.koegel@gmail.com>
Date:   Mon Apr 7 12:30:10 2014 +0300

    Don't check item->width twice (Bug 10534)
    
    There's no need to check item->width twice on the same line. Also
    checking for item->height isn't needed because the function never
    uses item->height but does set it at the end.
http://git.xfce.org/apps/ristretto/commit/?id=0afa544fd7e9ca3d589c4d2a9f0ef01a64f4816c

Bug #10534

Reported by:
David Binderman
Reported on: 2013-12-09
Last modified on: 2015-01-18

People

Assignee:
Stephan Arts
CC List:
1 user

Version

Version:
master

Attachments

Don't check item->width twice (872 bytes, patch)
2014-04-07 11:33 CEST , Eric Koegel
no flags

Additional information