commit bc96a14903c0b001120ddc939ab19302248eb2a0
parent 9f581446fd2c776f23adad603102a5363ff0c5a6
Author: sin <sin@2f30.org>
Date: Tue, 27 Aug 2013 10:35:48 +0100
No need to store strchr() return value to a local var
Diffstat:
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/smdev.c b/smdev.c
@@ -166,7 +166,7 @@ static void
parsepath(struct rule *rule, char *devpath, size_t devpathsz,
char *devname, size_t devnamesz)
{
- char buf[BUFSIZ], *p, *path;
+ char buf[BUFSIZ], *path;
char *dirc;
if (rule->path[0] != '=' && rule->path[0] != '>')
@@ -181,8 +181,7 @@ parsepath(struct rule *rule, char *devpath, size_t devpathsz,
return;
}
- p = strchr(path, '/');
- if (p) {
+ if (strchr(path, '/')) {
if (!(dirc = strdup(path)))
eprintf("strdup:");
snprintf(buf, sizeof(buf), "/dev/%s", dirname(dirc));