No need to store strchr() return value to a local var - smdev - suckless mdev
(HTM) git clone git://git.suckless.org/smdev
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit bc96a14903c0b001120ddc939ab19302248eb2a0
(DIR) parent 9f581446fd2c776f23adad603102a5363ff0c5a6
(HTM) 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:
M smdev.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
---
(DIR) 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));