Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] Use access instead of stat in hashdir



Thanks for the suggestion, but ...

On Feb 6,  6:43pm, Raghavendra D Prabhu wrote:
} 
} I found that using access instead of two stat calls

There's only one stat() call in the lines that you changed ...?

} results in 
} faster rehash when it is done. I came across this when I noticed 
} too many stat calls while 'strace -c' 

It also results in treating non-regular files as candidates for being
in the hash table, unless there's something about access() that is
implicitly performing the S_ISREG() test.

So you've broken the correctness of the HASH_EXECUTABLES_ONLY option.
Why not just leave it unset instead?  That's why it's an option.
 
}              if (unset(HASHEXECUTABLESONLY) ||
} -                   (stat(pathbuf, &statbuf) == 0 &&
} -                    S_ISREG(statbuf.st_mode) && (statbuf.st_mode & S_IXUGO)))
} +                   !access(pathbuf,X_OK))
}                  add = 1;
}          }



Messages sorted by: Reverse Date, Date, Thread, Author