diff liboctave/util/oct-glob.cc @ 32078:632f9b828de1

Avoid using file_stat in liboctave/util (bug #59711). * cmd-edit.cc (looks_like_filename), cmd-hist.cc (gnu_history::do_append), kpse.cc (kpse_element_dir), oct-glob.cc (glob, windows_glob), url-transfer.cc (base_url_transfer::mget_directory): Use functions "dir_exists" or "file_exists" instead of "file_stat". * kpse.cc (dir_p), oct-glob.cc (single_match_exists): Remove unused static functions.
author Markus Mützel <markus.muetzel@gmx.de>
date Sat, 06 May 2023 10:56:33 +0200
parents 597f3ee61a48
children b0785d76430a
line wrap: on
line diff
--- a/liboctave/util/oct-glob.cc	Fri May 05 19:49:23 2023 +0200
+++ b/liboctave/util/oct-glob.cc	Sat May 06 10:56:33 2023 +0200
@@ -53,14 +53,6 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-static bool
-single_match_exists (const std::string& file)
-{
-  sys::file_stat s (file);
-
-  return s.exists ();
-}
-
 OCTAVE_BEGIN_NAMESPACE(sys)
 
 bool
@@ -121,7 +113,7 @@
 
               if (n > 1
                   || (n == 1
-                      && single_match_exists (std::string (matches[0]))))
+                      && sys::file_exists (std::string (matches[0]))))
                 {
                   retval.resize (k+n);
 
@@ -371,7 +363,7 @@
 
               if (n > 1
                   || (n == 1
-                      && single_match_exists (std::string (matches[0]))))
+                      && sys::file_exists (std::string (matches[0]))))
                 {
                   retval.resize (k + n);