[hackers] [sbase] touch: Remove useless variable || Michael Forney

From: <git_AT_suckless.org>
Date: Sat, 9 Jul 2016 11:17:21 +0200 (CEST)

commit 36a0a6cd9201ff6e04f4040d0302c90ea3ee6c5d
Author: Michael Forney <mforney_AT_mforney.org>
AuthorDate: Fri Jul 8 10:24:12 2016 -0700
Commit: sin <sin_AT_2f30.org>
CommitDate: Sat Jul 9 10:17:16 2016 +0100

    touch: Remove useless variable
    
    The only possible return values of stat are 0 or -1, so it doesn't make sense to
    store the return value in a variable to make sure it is not positive.

diff --git a/touch.c b/touch.c
index 74bdc27..0e8c413 100644
--- a/touch.c
+++ b/touch.c
_AT_@ -21,14 +21,13 @@ touch(const char *file)
 {
         int fd;
         struct stat st;
- int r;
 
- if ((r = stat(file, &st)) < 0) {
+ if (stat(file, &st) < 0) {
                 if (errno != ENOENT)
                         eprintf("stat %s:", file);
                 if (cflag)
                         return;
- } else if (!r) {
+ } else {
                 if (!aflag)
                         times[0] = st.st_atim;
                 if (!mflag)
Received on Sat Jul 09 2016 - 11:17:21 CEST

This archive was generated by hypermail 2.3.0 : Sat Jul 09 2016 - 11:24:33 CEST