# HG changeset patch # User John W. Eaton # Date 1262014925 18000 # Node ID 62eb444704bafee83c5446653dc584fbc4286df1 # Parent e60f038146e17fd505ddb52d2c1f3380b2becaa4 file-ops.cc: avoid problems if sys/stat.h #defines mkdir or mkfifo diff -r e60f038146e1 -r 62eb444704ba liboctave/ChangeLog --- a/liboctave/ChangeLog Mon Dec 28 10:03:24 2009 +0100 +++ b/liboctave/ChangeLog Mon Dec 28 10:42:05 2009 -0500 @@ -1,3 +1,10 @@ +2009-12-28 John W. Eaton + + * 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 * file-stat.cc (lstat): Delete replacement function. diff -r e60f038146e1 -r 62eb444704ba liboctave/file-ops.cc --- a/liboctave/file-ops.cc Mon Dec 28 10:03:24 2009 +0100 +++ b/liboctave/file-ops.cc Mon Dec 28 10:42:05 2009 -0500 @@ -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 (); diff -r e60f038146e1 -r 62eb444704ba liboctave/file-ops.h --- a/liboctave/file-ops.h Mon Dec 28 10:03:24 2009 +0100 +++ b/liboctave/file-ops.h Mon Dec 28 10:42:05 2009 -0500 @@ -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.