changeset 8330:8303f0e912bc

load-path.cc (load_path::dir_info::update): simplify previous change
author John W. Eaton <jwe@octave.org>
date Mon, 17 Nov 2008 23:03:37 -0500
parents c91b59532f32
children 7418596586c3
files src/ChangeLog src/load-path.cc
diffstat 2 files changed, 20 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Mon Nov 17 22:30:39 2008 -0500
+++ b/src/ChangeLog	Mon Nov 17 23:03:37 2008 -0500
@@ -1,5 +1,8 @@
 2008-11-17  John W. Eaton  <jwe@octave.org>
 
+	* 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.
--- a/src/load-path.cc	Mon Nov 17 22:30:39 2008 -0500
+++ b/src/load-path.cc	Mon Nov 17 23:03:37 2008 -0500
@@ -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 ();
     }