From d0243a72d56326af2c5ff7b7b3823dbe57b3bd4c Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sat, 26 Sep 2015 12:54:18 -0400 Subject: Optimize -maxdepth in -depth mode. --- bftw.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'bftw.h') diff --git a/bftw.h b/bftw.h index f3be182..2082390 100644 --- a/bftw.h +++ b/bftw.h @@ -39,6 +39,16 @@ typedef enum { BFTW_ERROR, } bftw_typeflag; +/** + * Possible visit occurrences. + */ +typedef enum { + /** Pre-order visit. */ + BFTW_PRE, + /** Post-order visit. */ + BFTW_POST, +} bftw_visit; + /** * Data about the current file for the bftw() callback. */ @@ -50,6 +60,8 @@ struct BFTW { /** The depth of this file in the traversal. */ size_t depth; + /** Which visit this is. */ + bftw_visit visit; /** The file type. */ bftw_typeflag typeflag; @@ -93,7 +105,7 @@ typedef enum { BFTW_STAT = 1 << 0, /** Attempt to recover from encountered errors. */ BFTW_RECOVER = 1 << 1, - /** Visit all of a directory's descendants before the directory itself. */ + /** Visit directories in post-order as well as pre-order. */ BFTW_DEPTH = 1 << 2, } bftw_flags; -- cgit v1.2.3