Message ID | 200511221033.05622.holger.brunn@stud.uni-karlsruhe.de |
---|---|
State | New |
Headers |
Received: from smtprelay03.ispgateway.de ([80.67.18.15]) by www.linuxtv.org with esmtp (Exim 4.50) id 1EeUWR-0000qc-Hf for vdr@linuxtv.org; Tue, 22 Nov 2005 10:33:07 +0100 Received: (qmail 29162 invoked from network); 22 Nov 2005 09:33:06 -0000 Received: from unknown (HELO localhost.localdomain) (845114@[85.216.19.19]) (envelope-sender <holger.brunn@stud.uni-karlsruhe.de>) by smtprelay03.ispgateway.de (qmail-ldap-1.03) with AES256-SHA encrypted SMTP for <vdr@linuxtv.org>; 22 Nov 2005 09:33:06 -0000 Received: from shire.middleearth ([192.168.1.183]) by localhost.localdomain with esmtp (Exim 4.54) id 1EeUWQ-0004Ja-8Z for vdr@linuxtv.org; Tue, 22 Nov 2005 10:33:06 +0100 From: Holger Brunn <holger.brunn@stud.uni-karlsruhe.de> To: VDR Mailing List <vdr@linuxtv.org> Date: Tue, 22 Nov 2005 10:33:05 +0100 User-Agent: KMail/1.8.2 References: <E1EdBHd-00069k-H9@localhost.localdomain> <200511202149.54264.lists@magoa.net> <4380E953.7030509@uklinux.net> In-Reply-To: <4380E953.7030509@uklinux.net> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_RXugDcop6UEBR/e" Message-Id: <200511221033.05622.holger.brunn@stud.uni-karlsruhe.de> X-SA-Exim-Connect-IP: 192.168.1.183 X-SA-Exim-Mail-From: holger.brunn@stud.uni-karlsruhe.de X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on Lothlorien X-Spam-Level: X-Spam-Status: No, score=-4.3 required=3.5 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.0 Subject: Re: [vdr] Re: cString operator= with same buffer X-SA-Exim-Version: 4.2 (built Fri, 04 Mar 2005 01:30:41 +0100) X-SA-Exim-Scanned: Yes (on localhost.localdomain) X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: VDR Mailing List <vdr@linuxtv.org> List-Id: VDR Mailing List <vdr.linuxtv.org> List-Unsubscribe: <http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr>, <mailto:vdr-request@linuxtv.org?subject=unsubscribe> List-Archive: <http://www.linuxtv.org/pipermail/vdr> List-Post: <mailto:vdr@linuxtv.org> List-Help: <mailto:vdr-request@linuxtv.org?subject=help> List-Subscribe: <http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr>, <mailto:vdr-request@linuxtv.org?subject=subscribe> X-List-Received-Date: Tue, 22 Nov 2005 09:33:07 -0000 Status: O X-Status: X-Keywords: X-UID: 6298 |
Commit Message
Holger Brunn
Nov. 22, 2005, 9:33 a.m. UTC
> I think something should be done to fix the "assign cString to itself" > case, even though this is very unlikely. This does go wrong with the > current code, even with the copy constructor added. Okay, now as all seems to be said, here is a patch that checks for that case (that may happen when working with references/pointers to cStrings), leaving Klaus with the decision whether it's useful to have it or not. Greetings Holger
Comments
On Tuesday 22 November 2005 10:33, Holger Brunn wrote: > Okay, now as all seems to be said, here is a patch that checks for that > case (that may happen when working with references/pointers to cStrings), > leaving Klaus with the decision whether it's useful to have it or not. Is this the complete patch now? I still suggest adding a copy ctor (which should word like operator= without freeing).. Greetings, Sascha
> Is this the complete patch now? I still suggest adding a copy ctor (which > should word like operator= without freeing).. The copy constructor is added with the patch from an older posting (vdr-cstring-copyctor.diff). Regards Holger
Holger Brunn <holger.brunn@stud.uni-karlsruhe.de> wrote: > > I think something should be done to fix the "assign cString to > > itself" case, even though this is very unlikely. This does go wrong > > with the current code, even with the copy constructor added. > > Okay, now as all seems to be said, here is a patch that checks for > that case (that may happen when working with references/pointers to > cStrings), leaving Klaus with the decision whether it's useful to > have it or not. why not just: typedef std::string cString; or: class cString : public std::string { ... }; i really can't understand all this messing with a datatype allready implemented elsewhere. what is so special about cString that other string implementations do not have? my 0.02E clemens
Clemens Kirchgatterer wrote: >Holger Brunn <holger.brunn@stud.uni-karlsruhe.de> wrote: > > > >>>I think something should be done to fix the "assign cString to >>>itself" case, even though this is very unlikely. This does go wrong >>>with the current code, even with the copy constructor added. >>> >>> >>Okay, now as all seems to be said, here is a patch that checks for >>that case (that may happen when working with references/pointers to >>cStrings), leaving Klaus with the decision whether it's useful to >>have it or not. >> >> > >why not just: > >typedef std::string cString; > >or: > >class cString : public std::string { ... }; > >i really can't understand all this messing with a datatype allready >implemented elsewhere. what is so special about cString that other >string implementations do not have? > > AFAIR it is because of Klaus disliking standard stuff like stl, utf-8,gettext , ntpl and so on. regards, gunnar
diff -Nu vdr-1.3.36-org/tools.c vdr-1.3.36/tools.c --- vdr-1.3.36-org/tools.c 2005-11-20 12:58:55.000000000 +0100 +++ vdr-1.3.36/tools.c 2005-11-22 10:22:31.000000000 +0100 @@ -539,6 +539,7 @@ cString &cString::operator=(const cString &String) { + if(this==&String) return *this; free(s); s = String.s ? strdup(String.s) : NULL; return *this;