]> git.notmuchmail.org Git - notmuch/commit
add_files_recursive: Separate scanning for directories and files for legibility.
authorCarl Worth <cworth@cworth.org>
Wed, 6 Jan 2010 00:35:02 +0000 (16:35 -0800)
committerCarl Worth <cworth@cworth.org>
Wed, 6 Jan 2010 18:32:06 +0000 (10:32 -0800)
commit28ce73848d98d8ee2b661733402e2c10b13418d5
tree04a1d51cbd5d6b8fcdfb792e0ca010db4b59ca24
parent6f05dd8a8c51d23f47fce608e3eb25cd8e1c8bd1
add_files_recursive: Separate scanning for directories and files for legibility.

We now do two scans over the entries returned from scandir. The first
scan is looking for directories (and making the recursive call). The
second scan is looking for new files to add to the database.

This is easier to read than the previous code which had a single loop
and some if statements with ridiculously long bodies. It also has the
advantage that once the directory scan is complete we can do a single
comparison of the filesystem and database mtimes and entirely skip the
second scan if it's not needed.
notmuch-new.c