ecore-input-evas: Fix Coverity CID1306803 (logically dead code)
authorChris Michael <cp.michael@samsung.com>
Thu, 18 Jun 2015 14:20:07 +0000 (10:20 -0400)
committerChris Michael <cp.michael@samsung.com>
Thu, 18 Jun 2015 14:20:07 +0000 (10:20 -0400)
Summary: This cleans up the _ecore_event_evas_mouse_button function.
Coverity was reporting that the state tests in the 'if' function could
not be be reached due to eel variable being null. This moves the if
(!eel) check to run before the state tests.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
src/lib/ecore_input_evas/ecore_input_evas.c

index 938217c..b9b3082 100644 (file)
@@ -459,14 +459,17 @@ _ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Press pr
      {
         //ECORE_UP or ECORE_CANCEL
         eel = _ecore_event_evas_lookup(e->multi.device, e->buttons, EINA_FALSE);
+        if (!eel)
+          {
+             WRN("ButtonEvent has no history.");
+             return ECORE_CALLBACK_PASS_ON;
+          }
 
-        if ((!eel) || (eel->state == ECORE_INPUT_UP) || (eel->state == ECORE_INPUT_CANCEL))
+        if ((eel->state == ECORE_INPUT_UP) ||
+            (eel->state == ECORE_INPUT_CANCEL))
           {
-            if (!eel)
-              WRN("ButtonEvent has no history.");
-            else
-              WRN("ButtonEvent has wrong history. Last state=%d", eel->state);
-            return ECORE_CALLBACK_PASS_ON;
+             WRN("ButtonEvent has wrong history. Last state=%d", eel->state);
+             return ECORE_CALLBACK_PASS_ON;
           }
      }