# HG changeset patch # User John W. Eaton # Date 1226981017 18000 # Node ID 8303f0e912bc6663248c85e9284632e7f9d5539b # Parent c91b59532f32e9223bbb3e34a7a6f0b3219ae137 load-path.cc (load_path::dir_info::update): simplify previous change diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2008-11-17 John W. Eaton + * load-path.cc (load_path::dir_info::update): Simplify previous + change. + * load-path.h (load_path::dir_info::abs_dir_name): New data member. (load_path::dir_info::dir_info, load_path::dir_info::operator =): Copy abs_dir_name. diff --git a/src/load-path.cc b/src/load-path.cc --- a/src/load-path.cc +++ b/src/load-path.cc @@ -52,28 +52,28 @@ void load_path::dir_info::update (void) { - if (is_relative) + file_stat fs (dir_name); + + if (fs) { - std::string abs_name - = octave_env::make_absolute (dir_name, octave_env::getcwd ()); - - abs_dir_cache_iterator p = abs_dir_cache.find (abs_name); - - if (p != abs_dir_cache.end ()) + if (is_relative) { - // The directory is in the cache of all directories we have - // visited (indexed by its absolute name). If it is out of - // date, initialize it. Otherwise, copy the info from the - // cache. By doing that, we avoid unnecessary calls to stat - // that can slow things down tremendously for large - // directories. + std::string abs_name + = octave_env::make_absolute (dir_name, octave_env::getcwd ()); + + abs_dir_cache_iterator p = abs_dir_cache.find (abs_name); - const dir_info& di = p->second; + if (p != abs_dir_cache.end ()) + { + // The directory is in the cache of all directories we have + // visited (indexed by its absolute name). If it is out of + // date, initialize it. Otherwise, copy the info from the + // cache. By doing that, we avoid unnecessary calls to stat + // that can slow things down tremendously for large + // directories. - file_stat fs (dir_name); + const dir_info& di = p->second; - if (fs) - { if (fs.mtime () != di.dir_mtime) initialize (); else @@ -81,18 +81,8 @@ return; } - else - { - std::string msg = fs.error (); - warning ("load_path: %s: %s", dir_name.c_str (), msg.c_str ()); - } } - } - file_stat fs (dir_name); - - if (fs) - { if (fs.mtime () != dir_mtime) initialize (); }