diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-10-29 18:40:23 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-11-20 06:38:35 +0100 |
commit | f921b457a784b8f3edffcac7db79c940634c35f9 (patch) | |
tree | 98ded313fb8146db733e669631b78a1d18bd2b5e /src/libudev/libudev-util.c | |
parent | libudev-list: move libudev-list related definitions to libudev-list-internal.h (diff) | |
download | systemd-f921b457a784b8f3edffcac7db79c940634c35f9.tar.xz systemd-f921b457a784b8f3edffcac7db79c940634c35f9.zip |
libudev: coding style fixes
Diffstat (limited to 'src/libudev/libudev-util.c')
-rw-r--r-- | src/libudev/libudev-util.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libudev/libudev-util.c b/src/libudev/libudev-util.c index 8007463581..f07b29ab48 100644 --- a/src/libudev/libudev-util.c +++ b/src/libudev/libudev-util.c @@ -36,13 +36,13 @@ int util_resolve_subsys_kernel(const char *string, subsys = &temp[1]; sysname = strchr(subsys, '/'); - if (sysname == NULL) + if (!sysname) return -1; sysname[0] = '\0'; sysname = &sysname[1]; attr = strchr(sysname, ']'); - if (attr == NULL) + if (!attr) return -1; attr[0] = '\0'; attr = &attr[1]; @@ -51,18 +51,18 @@ int util_resolve_subsys_kernel(const char *string, if (attr[0] == '\0') attr = NULL; - if (read_value && attr == NULL) + if (read_value && !attr) return -1; dev = udev_device_new_from_subsystem_sysname(NULL, subsys, sysname); - if (dev == NULL) + if (!dev) return -1; if (read_value) { const char *val; val = udev_device_get_sysattr_value(dev, attr); - if (val != NULL) + if (val) strscpy(result, maxsize, val); else result[0] = '\0'; @@ -73,7 +73,7 @@ int util_resolve_subsys_kernel(const char *string, s = result; l = strpcpyl(&s, maxsize, udev_device_get_syspath(dev), NULL); - if (attr != NULL) + if (attr) strpcpyl(&s, l, "/", attr, NULL); log_debug("path '[%s/%s]%s' is '%s'", subsys, sysname, attr, result); } @@ -180,7 +180,7 @@ int util_replace_chars(char *str, const char *white) { } /* if space is allowed, replace whitespace with ordinary space */ - if (isspace(str[i]) && white != NULL && strchr(white, ' ') != NULL) { + if (isspace(str[i]) && white && strchr(white, ' ')) { str[i] = ' '; i++; replaced++; |