libvirt

/

libvirt

branch iconmaster

arrow to build time
clock icon23 mins and 17 secs

Michal Privoznik avatarMichal Privoznik

Drop needless ret variable

In few places we have the following code pattern:

int ret;
... /* @ret is not accessed here */
ret = f(...);
return ret;

This pattern can be written less verbose:

...
return f(...);

This patch was generated with following coccinelle spatch:

@@
type T;
constant C;
expression f;
identifier ret;
@@
-T ret = C;
... when != ret
-ret = f;
-return ret;
+return f;

Afterwards I needed to fix a few places, e.g. comment in
virDomainNetIPParseXML() was removed too because coccinelle
thinks it refers to @ret while in fact it doesn't. Also in few
places it replaced @ret declaration with a few spaces instead of
removing the line. But nothing terribly wrong.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>

Want to know about upcoming build environment updates?

Would you like to stay up-to-date with the upcoming Travis CI build environment updates? We set up a mailing list for you!

SIGN UP HERE
book icon

Documentation about Travis CI