bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #30868] Take advantage of dirent.d_type to save a stat()


From: Nick Welch
Subject: [bug #30868] Take advantage of dirent.d_type to save a stat()
Date: Tue, 24 Aug 2010 22:22:41 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.5 (KHTML, like Gecko) Chrome/6.0.487.0 Safari/534.5

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/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]