From a70a71b45ad9d97bb431c84fe20d234c338d060c Mon Sep 17 00:00:00 2001 From: lucas Date: Wed, 14 Jul 2010 02:05:47 +0000 Subject: [PATCH] Remove unneeded code with notnull.cocci script The notnull.cocci script from Coccinelle finds places where you check if a variable is NULL, but it's known not to be NULL. The check can be safely removed. For example, this code would be caught by notnull: if (!var) return; if (var && var->fld) { ... } It's needless to check again if var is not NULL because if it's in fact NULL, it would have returned on the previous "if". This commit removes all the trivial places where this pattern happens. Another patch will be generated for the more complex cases. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@50241 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/ecore_x/xcb/ecore_xcb_icccm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lib/ecore_x/xcb/ecore_xcb_icccm.c b/src/lib/ecore_x/xcb/ecore_xcb_icccm.c index 7d39f47..9787306 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_icccm.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_icccm.c @@ -1336,8 +1336,7 @@ ecore_x_icccm_command_get(Ecore_X_Window window __UNUSED__, if (c < 1) { - if (v) - free(v); + free(v); return; } -- 2.7.4