Mercurial > hg > octave-lyh
diff liboctave/file-ops.cc @ 8009:d936b21b3a6b
file_ops: use singleton class for static data members
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 05 Aug 2008 12:14:16 -0400 |
parents | a2ab20ba78f7 |
children | 4a7a943581d0 |
line wrap: on
line diff
--- a/liboctave/file-ops.cc +++ b/liboctave/file-ops.cc @@ -51,7 +51,9 @@ #include "statdefs.h" #include "str-vec.h" -file_ops::file_ops (void) +file_ops::static_members *file_ops::static_members::instance = 0; + +file_ops::static_members::static_members (void) : #if (defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM)) xdir_sep_char ('\\'), @@ -67,20 +69,18 @@ #endif { } -file_ops *file_ops::instance = 0; - bool -file_ops::instance_ok (void) +file_ops::static_members::instance_ok (void) { bool retval = true; if (! instance) - instance = new file_ops (); + instance = new static_members (); if (! instance) { (*current_liboctave_error_handler) - ("unable to create file_ops object!"); + ("unable to create file_ops::static_members object!"); retval = false; }