Mercurial > hg > octave-lojdl
changeset 10038:62eb444704ba
file-ops.cc: avoid problems if sys/stat.h #defines mkdir or mkfifo
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 28 Dec 2009 10:42:05 -0500 |
parents | e60f038146e1 |
children | 1e306aa51d6c |
files | liboctave/ChangeLog liboctave/file-ops.cc liboctave/file-ops.h |
diffstat | 3 files changed, 35 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,10 @@ +2009-12-28 John W. Eaton <jwe@octave.org> + + * file-ops.cc (fle_ops::mkdir_internal, + file_ops::mkfifo_internal): New private static functions. + * file-ops.h (file_ops::mkdir, file_ops::mkdir): Move + definitions here from file-ops.cc. Forward to X_internal functions. + 2009-12-26 John W. Eaton <jwe@octave.org> * file-stat.cc (lstat): Delete replacement function.
--- a/liboctave/file-ops.cc +++ b/liboctave/file-ops.cc @@ -95,14 +95,8 @@ // We provide a replacement for mkdir(). int -file_ops::mkdir (const std::string& name, mode_t mode) -{ - std::string msg; - return mkdir (name, mode, msg); -} - -int -file_ops::mkdir (const std::string& name, mode_t mode, std::string& msg) +file_ops::mkdir_internal (const std::string& name, mode_t mode, + std::string& msg) { msg = std::string (); @@ -122,14 +116,8 @@ // I don't know how to emulate this on systems that don't provide it. int -file_ops::mkfifo (const std::string& name, mode_t mode) -{ - std::string msg; - return mkfifo (name, mode, msg); -} - -int -file_ops::mkfifo (const std::string& name, mode_t mode, std::string& msg) +file_ops::mkfifo_internal (const std::string& name, mode_t mode, + std::string& msg) { msg = std::string ();
--- a/liboctave/file-ops.h +++ b/liboctave/file-ops.h @@ -37,11 +37,27 @@ { public: - static int mkdir (const std::string&, mode_t); - static int mkdir (const std::string&, mode_t, std::string&); + static int mkdir (const std::string& nm, mode_t md) + { + std::string msg; + return mkdir_internal (nm, md, msg); + } + + static int mkdir (const std::string& nm, mode_t md, std::string& msg) + { + return mkdir_internal (nm, md, msg); + } - static int mkfifo (const std::string&, mode_t); - static int mkfifo (const std::string&, mode_t, std::string&); + static int mkfifo (const std::string& nm, mode_t md) + { + std::string msg; + return mkfifo_internal (nm, md, msg); + } + + static int mkfifo (const std::string& nm, mode_t md, std::string& msg) + { + return mkfifo_internal (nm, md, msg); + } static int link (const std::string&, const std::string&); static int link (const std::string&, const std::string&, std::string&); @@ -124,6 +140,10 @@ private: + static int mkdir_internal (const std::string&, mode_t, std::string&); + + static int mkfifo_internal (const std::string&, mode_t, std::string&); + // Use a singleton class for these data members instead of just // making them static members of the dir_path class so that we can // ensure proper initialization.