diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2005-11-26 14:16:02 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2005-11-26 14:16:02 +0100 |
commit | 22c5a38364cbe0df1b710e8cf9e31141adac441c (patch) | |
tree | ac1aa1cf817ee6e3f0d2cfcfc13ed8fca432b90c /tools.c | |
parent | 71ccb6acb62fed319367fc71108d5b3fff8f3a5b (diff) | |
download | vdr-22c5a38364cbe0df1b710e8cf9e31141adac441c.tar.gz vdr-22c5a38364cbe0df1b710e8cf9e31141adac441c.tar.bz2 |
Added a copy constructor to cString and fixed its assignment operator
Diffstat (limited to 'tools.c')
-rw-r--r-- | tools.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.c 1.103 2005/11/04 16:33:18 kls Exp $ + * $Id: tools.c 1.104 2005/11/26 14:12:31 kls Exp $ */ #include "tools.h" @@ -527,6 +527,11 @@ cString::cString(const char *S, bool TakePointer) s = TakePointer ? (char *)S : S ? strdup(S) : NULL; } +cString::cString(const cString &String) +{ + s = String.s ? strdup(String.s) : NULL; +} + cString::~cString() { free(s); @@ -534,6 +539,8 @@ cString::~cString() cString &cString::operator=(const cString &String) { + if (this == &String) + return *this; free(s); s = String.s ? strdup(String.s) : NULL; return *this; |