treewide: yet more log_*_errno + return simplifications

Using:
find . -name '*.[ch]' | while read f; do perl -i.mmm -e \
 'local $/;
  local $_=<>;
  s/(if\s*\([^\n]+\))\s*{\n(\s*)(log_[a-z_]*_errno\(\s*([->a-zA-Z_]+)\s*,[^;]+);\s*return\s+\g4;\s+}/\1\n\2return \3;/msg;
  print;'
 $f
done

And a couple of manual whitespace fixups.
This commit is contained in:
Michal Schmidt
2014-11-28 18:56:16 +01:00
parent e80733be33
commit f647962d64
44 changed files with 476 additions and 947 deletions
+10 -20
View File
@@ -190,10 +190,8 @@ static int list_links(char **args, unsigned n) {
pager_open_if_enabled();
r = sd_rtnl_open(&rtnl, 0);
if (r < 0) {
log_error_errno(r, "Failed to connect to netlink: %m");
return r;
}
if (r < 0)
return log_error_errno(r, "Failed to connect to netlink: %m");
udev = udev_new();
if (!udev) {
@@ -210,10 +208,8 @@ static int list_links(char **args, unsigned n) {
return rtnl_log_create_error(r);
r = sd_rtnl_call(rtnl, req, 0, &reply);
if (r < 0) {
log_error_errno(r, "Failed to enumerate links: %m");
return r;
}
if (r < 0)
return log_error_errno(r, "Failed to enumerate links: %m");
if (arg_legend)
printf("%3s %-16s %-18s %-11s %-10s\n", "IDX", "LINK", "TYPE", "OPERATIONAL", "SETUP");
@@ -322,10 +318,8 @@ static int link_status_one(sd_rtnl *rtnl, struct udev *udev, const char *name) {
return rtnl_log_create_error(r);
r = sd_rtnl_call(rtnl, req, 0, &reply);
if (r < 0) {
log_error_errno(r, "Failed to query link: %m");
return r;
}
if (r < 0)
return log_error_errno(r, "Failed to query link: %m");
r = sd_rtnl_message_link_get_ifindex(reply, &ifindex);
if (r < 0)
@@ -447,10 +441,8 @@ static int link_status(char **args, unsigned n) {
int r;
r = sd_rtnl_open(&rtnl, 0);
if (r < 0) {
log_error_errno(r, "Failed to connect to netlink: %m");
return r;
}
if (r < 0)
return log_error_errno(r, "Failed to connect to netlink: %m");
udev = udev_new();
if (!udev) {
@@ -513,10 +505,8 @@ static int link_status(char **args, unsigned n) {
return rtnl_log_create_error(r);
r = sd_rtnl_call(rtnl, req, 0, &reply);
if (r < 0) {
log_error_errno(r, "Failed to enumerate links: %m");
return r;
}
if (r < 0)
return log_error_errno(r, "Failed to enumerate links: %m");
c = decode_and_sort_links(reply, &links);
if (c < 0)