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. SVN revision: 50241
This commit is contained in:
parent
baa8f7abf9
commit
118b441611
|
@ -278,7 +278,7 @@ BackgroundDelete(Background * bg)
|
|||
#if 0
|
||||
Eprintf("%s: %s\n", __func__, bg->name);
|
||||
#endif
|
||||
if (!bg || bg->ref_count > 0)
|
||||
if (bg->ref_count > 0)
|
||||
return;
|
||||
|
||||
/* And delete the actual image files */
|
||||
|
|
|
@ -89,7 +89,7 @@ Estrdupcat2(char *ss, const char *s1, const char *s2)
|
|||
if (!ss)
|
||||
return Estrdup(s2);
|
||||
|
||||
len = (ss) ? strlen(ss) : 0;
|
||||
len = strlen(ss);
|
||||
l1 = (s1) ? strlen(s1) : 0;
|
||||
l2 = (s2) ? strlen(s2) : 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue