1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-11 05:17:44 +03:00

sysv-generator: fix coding-style

Fix weird coding-style:
 - proper white-space
 - no if (func() >= 0) bail-outs
 - fix braces
 - avoid 'r' for anything but errno
 - init _cleanup_ variables unconditionally, even if not needed
This commit is contained in:
David Herrmann 2015-07-01 13:02:58 +02:00
parent e04658277d
commit 0b2ec8a3bf

View File

@ -240,22 +240,21 @@ static bool usage_contains_reload(const char *line) {
} }
static char *sysv_translate_name(const char *name) { static char *sysv_translate_name(const char *name) {
char *r; _cleanup_free_ char *c = NULL;
_cleanup_free_ char *c; char *res;
c = strdup(name); c = strdup(name);
if (!c) if (!c)
return NULL; return NULL;
r = endswith(c, ".sh"); res = endswith(c, ".sh");
if (r) { if (res)
*r = '\0'; *res = 0;
}
if (unit_name_mangle(c, UNIT_NAME_NOGLOB, &r) >= 0) if (unit_name_mangle(c, UNIT_NAME_NOGLOB, &res) < 0)
return r; return NULL;
else
return NULL; return res;
} }
static int sysv_translate_facility(const char *name, const char *filename, char **_r) { static int sysv_translate_facility(const char *name, const char *filename, char **_r) {
@ -377,8 +376,7 @@ static int handle_provides(SysvStub *s, unsigned line, const char *full_text, co
if (r < 0) if (r < 0)
return log_oom(); return log_oom();
} }
} } else if (t == _UNIT_TYPE_INVALID)
else if (t == _UNIT_TYPE_INVALID)
log_warning("Unit name '%s' is invalid", m); log_warning("Unit name '%s' is invalid", m);
else else
log_warning("Unknown unit type for unit '%s'", m); log_warning("Unknown unit type for unit '%s'", m);