From 840f24c5af8ad7027037d688baed37ad8d388980 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Tue, 18 Jul 2023 11:15:15 +0000 Subject: GC unused SetFileName --- vespalib/src/vespa/fastos/file.cpp | 11 +---------- vespalib/src/vespa/fastos/file.h | 30 +++++++++--------------------- vespalib/src/vespa/fastos/unix_file.cpp | 2 +- 3 files changed, 11 insertions(+), 32 deletions(-) diff --git a/vespalib/src/vespa/fastos/file.cpp b/vespalib/src/vespa/fastos/file.cpp index c8cce99b169..44c8ee8025e 100644 --- a/vespalib/src/vespa/fastos/file.cpp +++ b/vespalib/src/vespa/fastos/file.cpp @@ -40,13 +40,11 @@ static const size_t MAX_CHUNK_SIZE = 0x4000000; // 64 MB FastOS_FileInterface::FastOS_FileInterface(const char *filename) : _fAdviseOptions(_defaultFAdviseOptions), _chunkSize(MAX_CHUNK_SIZE), - _filename(), + _filename(filename != nullptr ? filename : ""), _openFlags(0), _directIOEnabled(false), _syncWritesEnabled(false) { - if (filename != nullptr) - SetFileName(filename); } @@ -207,13 +205,6 @@ FastOS_FileInterface::IsMemoryMapped() const return false; } -void -FastOS_FileInterface::SetFileName(const char *filename) -{ - _filename = filename; -} - - const char * FastOS_FileInterface::GetFileName() const { diff --git a/vespalib/src/vespa/fastos/file.h b/vespalib/src/vespa/fastos/file.h index 84b94df5acc..8f155fe54a5 100644 --- a/vespalib/src/vespa/fastos/file.h +++ b/vespalib/src/vespa/fastos/file.h @@ -99,7 +99,7 @@ public: /** * Constructor. A filename could be supplied at this point, or specified - * later using @ref SetFileName() or @ref Open(). + * later using @ref Open(). * @param filename a filename (optional) */ FastOS_FileInterface(const char *filename=nullptr); @@ -110,14 +110,6 @@ public: */ virtual ~FastOS_FileInterface(); - /** - * Associate a new filename with this object. This filename will be - * used when performing @ref Open() (unless @ref Open() specifies a - * different filename). - * @param filename filename character string (will be copied internally) - */ - virtual void SetFileName(const char *filename); - /** * Return the filename associated with the File object. If no filename * has been set, an empty string is returned instead. @@ -136,8 +128,7 @@ public: * @param filename You may optionally specify a filename here. This * will replace the currently associated filename * (if any) set using either the constructor, - * @ref SetFileName() or a previous call to - * @ref Open(). + * or a previous call to @ref Open(). * @return Boolean success/failure */ virtual bool Open(unsigned int openFlags, const char *filename=nullptr) = 0; @@ -148,7 +139,7 @@ public: * @param filename You may optionally specify a filename here. This * will replace the currently associated filename * (if any) set using either the constructor, - * @ref SetFileName() or a previous call to @ref Open(). + * or a previous call to @ref Open(). * @return Boolean success/failure */ bool OpenReadWrite(const char *filename=nullptr); @@ -160,7 +151,7 @@ public: * @param filename You may optionally specify a filename here. This * will replace the currently associated filename * (if any) set using either the constructor, - * @ref SetFileName() or a previous call to + * or a previous call to * @ref Open(). * @return Boolean success/failure */ @@ -173,8 +164,7 @@ public: * @param filename You may optionally specify a filename here. This * will replace the currently associated filename * (if any) set using either the constructor, - * @ref SetFileName() or a previous call to - * @ref Open(). + * or a previous call to @ref Open(). * @return Boolean success/failure */ bool OpenReadOnlyExisting (bool abortIfNotExist=false, const char *filename=nullptr); @@ -185,8 +175,7 @@ public: * @param filename You may optionally specify a filename here. This * will replace the currently associated filename * (if any) set using either the constructor, - * @ref SetFileName() or a previous call to - * @ref Open(). + * or a previous call to @ref Open(). * @return Boolean success/failure */ bool OpenWriteOnlyTruncate(const char *filename=nullptr); @@ -198,8 +187,7 @@ public: * @param filename You may optionally specify a filename here. This * will replace the currently associated filename * (if any) set using either the constructor, - * @ref SetFileName() or a previous call to - * @ref Open(). + * or a previous call to @ref Open(). * @return Boolean success/failure */ bool OpenWriteOnlyExisting (bool abortIfNotExist=false, const char *filename=nullptr); @@ -210,7 +198,7 @@ public: * @param filename You may optionally specify a filename here. This * will replace the currently associated filename * (if any) set using either the constructor, - * @ref SetFileName() or a previous call to @ref Open(). + * or a previous call to @ref Open(). * @return Boolean success/failure */ bool OpenReadOnly(const char *filename=nullptr); @@ -221,7 +209,7 @@ public: * @param filename You may optionally specify a filename here. This * will replace the currently associated filename * (if any) set using either the constructor, - * @ref SetFileName() or a previous call to @ref Open(). + * or a previous call to Open(). * @return Boolean success/failure */ bool OpenWriteOnly(const char *filename=nullptr); diff --git a/vespalib/src/vespa/fastos/unix_file.cpp b/vespalib/src/vespa/fastos/unix_file.cpp index 952d9820306..4d0245cd079 100644 --- a/vespalib/src/vespa/fastos/unix_file.cpp +++ b/vespalib/src/vespa/fastos/unix_file.cpp @@ -208,7 +208,7 @@ FastOS_UNIX_File::Open(unsigned int openFlags, const char *filename) assert(_filedes == -1); if (filename != nullptr) { - SetFileName(filename); + _filename = filename; } unsigned int accessFlags = CalcAccessFlags(openFlags); -- cgit v1.2.3