diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 0d383b9e..a17950e8 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2560,6 +2560,7 @@ Markus Ehrnsperger for making using a dummy OSD if no OSD provider is available not be considered an error any more for removing syslog calls in child process after fork() + for adding the move constructor to cString for better performance Werner Färber for reporting a bug in handling the cPluginManager::Active() result when pressing diff --git a/HISTORY b/HISTORY index 48ff1073..77706b81 100644 --- a/HISTORY +++ b/HISTORY @@ -9863,7 +9863,7 @@ Video Disk Recorder Revision History - The recording info of the default skins now shows the frame parameters of the recording at the end of the description (if such information is available). -2024-01-19: +2024-01-20: - Changed installing config files to handle potentially broken 'cp -n'. - Fixed height calculation in progress display (thanks to Matthias Senzel). @@ -9877,3 +9877,5 @@ Video Disk Recorder Revision History (thanks to Matthias Senzel). - Fixed an unnecessary double display of menu items in the Recordings menu (thanks to Matthias Senzel). +- Added the move constructor to cString for better performance (thanks to Markus + Ehrnsperger). diff --git a/tools.c b/tools.c index 418c07f5..c6eb6ff6 100644 --- a/tools.c +++ b/tools.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.c 5.8 2023/12/29 10:24:29 kls Exp $ + * $Id: tools.c 5.9 2024/01/20 13:59:55 kls Exp $ */ #include "tools.h" @@ -1106,6 +1106,14 @@ cString &cString::operator=(const cString &String) return *this; } +cString &cString::operator=(cString &&String) +{ + free(s); + s = String.s; + String.s = NULL; + return *this; +} + cString &cString::operator=(const char *String) { if (s == String) diff --git a/tools.h b/tools.h index dcfbf250..5f50cfe0 100644 --- a/tools.h +++ b/tools.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.h 5.7 2023/12/29 10:21:59 kls Exp $ + * $Id: tools.h 5.8 2024/01/20 13:59:55 kls Exp $ */ #ifndef __TOOLS_H @@ -182,11 +182,13 @@ public: cString(const char *S = NULL, bool TakePointer = false); cString(const char *S, const char *To); ///< Copies S up to To (exclusive). To must be a valid pointer into S. If To is NULL, everything is copied. cString(const cString &String); + cString(cString &&String): s(String.s) { String.s = NULL; } virtual ~cString(); operator const void * () const { return s; } // to catch cases where operator*() should be used operator const char * () const { return s; } // for use in (const char *) context const char * operator*() const { return s; } // for use in (const void *) context (printf() etc.) cString &operator=(const cString &String); + cString &operator=(cString &&String); cString &operator=(const char *String); cString &Append(const char *String); cString &Append(char c);