diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-01-07 15:42:28 +0100 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2018-01-11 06:07:13 +0100 |
commit | 6a07ccbad273cdcbea3f984c5c2e9d1b272aae05 (patch) | |
tree | d389058bb3a66b0cce63331ce325ad34fee6ff22 /core/linux.c | |
parent | e85ecdd9254a8bd222ccb2dfed7d3b3bb96c8294 (diff) | |
download | subsurface-6a07ccbad273cdcbea3f984c5c2e9d1b272aae05.tar.gz |
Use helper function empty_string() instead of manual checks
For code consistency, substitute boolean expressions:
s && *s -> !empty_string(s)
s && s[0] -> !empty_string(s)
!s || !*s -> empty_string(s)
!s || !s[0] -> empty_string(s)
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/linux.c')
-rw-r--r-- | core/linux.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/linux.c b/core/linux.c index 5403990b7..2ae4d5c7e 100644 --- a/core/linux.c +++ b/core/linux.c @@ -31,12 +31,12 @@ void subsurface_user_info(struct user_info *user) const char *username = getenv("USER"); if (pwd) { - if (pwd->pw_gecos && *pwd->pw_gecos) + if (!empty_string(pwd->pw_gecos)) user->name = pwd->pw_gecos; if (!username) username = pwd->pw_name; } - if (username && *username) { + if (!empty_string(username)) { char hostname[64]; struct membuffer mb = {}; gethostname(hostname, sizeof(hostname)); |