[hackers] [sbase] Reuse 'n' in cmp(1) || FRIGN

From: <git_AT_suckless.org>
Date: Sat, 7 Feb 2015 22:54:32 +0100 (CET)

commit af5d9f7baf62280a8dd80f94ba634a3a17d8efcf
Author: FRIGN <dev_AT_frign.de>
Date: Sat Feb 7 21:13:54 2015 +0100

    Reuse 'n' in cmp(1)
    
    Factors out one more local variable.

diff --git a/cmp.c b/cmp.c
index 8bcef66..435048f 100644
--- a/cmp.c
+++ b/cmp.c
_AT_@ -18,7 +18,7 @@ int
 main(int argc, char *argv[])
 {
         FILE *fp[2];
- size_t i, line = 1, n = 1;
+ size_t line = 1, n;
         int lflag = 0, sflag = 0, same = 1, b[2];
 
         ARGBEGIN {
_AT_@ -38,13 +38,13 @@ main(int argc, char *argv[])
         if (!strcmp(argv[0], argv[1]))
                 return Same;
 
- for (i = 0; i < 2; i++) {
- if (argv[i][0] == '-' && !argv[i][1])
- argv[i] = "/dev/fd/0";
- fp[i] = fopen(argv[i], "r");
- if (!fp[i]) {
+ for (n = 0; n < 2; n++) {
+ if (argv[n][0] == '-' && !argv[n][1])
+ argv[n] = "/dev/fd/0";
+ fp[n] = fopen(argv[n], "r");
+ if (!fp[n]) {
                         if (!sflag)
- weprintf("fopen %s:", argv[i]);
+ weprintf("fopen %s:", argv[n]);
                         exit(Error);
                 }
         }
Received on Sat Feb 07 2015 - 22:54:32 CET

This archive was generated by hypermail 2.3.0 : Sat Feb 07 2015 - 23:00:13 CET