[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] grep: check stdin like other files
From: |
Paul Eggert |
Subject: |
Re: [PATCH] grep: check stdin like other files |
Date: |
Sun, 01 Jan 2012 11:17:08 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:8.0) Gecko/20111124 Thunderbird/8.0 |
On 01/01/12 05:50, Jim Meyering wrote:
> IMHO, "_result" is an unnecessarily generic name, and decl-after-stmt
> is ok for grep proper (but not dfa.c), so how about this instead?
>
> bool stat_fail = (desc < 0
> ? stat (file, &stats->stat)
> : fstat (desc, &stats->stat));
> if (stat_fail)
> {
> ...
It turns out that the variable wasn't used anywhere else (in a previous
version of the code it was, but I missed this while refactoring)
and so I simplified it further to:
if (desc < 0
? stat (file, &stats->stat) != 0
: fstat (desc, &stats->stat) != 0)
I made the other changes you suggested, and pushed it.