URL:
<http://savannah.gnu.org/bugs/?30868>
Summary: Take advantage of dirent.d_type to save a stat()
Project: grep
Submitted by: mackstann
Submitted on: Tue 24 Aug 2010 10:22:40 PM GMT
Category: None
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
In lib/savedir.c, in isdir1() (or the code that calls it), the d_type member
of the dirent struct can be checked instead of doing a comparatively expensive
isdir() (which calls stat()).
This d_type member is not supported by all systems or filesystems. The block
of code referencing d_type should be wrapped with an #ifdef
_DIRENT_HAVE_D_TYPE. The value of d_type will be DT_UNKNOWN if the filesystem
does not support d_type.
See here for more details:
http://manpages.courier-mta.org/htmlman3/readdir.3.html
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?30868>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/