apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject Re: cvs commit: apr/file_io/unix filestat.c
Date Thu, 12 Dec 2002 15:46:26 GMT
At 09:28 AM 12/12/2002, Brane wrote:
>William A. Rowe, Jr. wrote:
>
>>At 06:49 AM 12/12/2002, Jeff Trawick wrote:
>>  
>>
>>>wrowe@apache.org writes:
>>>
>>>    
>>>
>>>>wrowe       2002/12/11 23:01:52
>>>>
>>>>  Modified:    file_io/unix filestat.c
>>>>  Log:
>>>>    switch {case} and default: are probably better for handling this case.
>>>>    Is anyone aware of a platform where S_IFxxx # isn't available, yet
>>>>    S_ISxxx(#) is?
>>>>      
>>>>
>>>RH Linux 7.3 doesn't have S_IFFIFO
>>
>>Yet it does have S_ISFIFO?
>
>The funny thing about this change is that, for a short switch like that,
>many modern compilers just convert it to a series of "if ... else if"
>tests. So just putting the "else"s in there wouldn've been better -- not
>to mention more correct. I don't think generating a jump table for just
>seven cases makes sense on any platform.

While I agree with you if the tests...

if (i == S_IFxxx)      if (S_IFxxx(i))

were identical, they aren't.  This change still gains us the potential benefit
(possibly optimized away) of not remasking the type from the mode repeatedly.

I've worked around missing S_IFFIFO and S_IFSOCK.  If there are others
on other odd platforms, I'll surrender, revert the patch and add the missing
else-es (in the better order they are given now; reg, dir, lnk etc.)

Bill




Mime
View raw message