From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12071 invoked by alias); 21 Dec 2006 13:04:48 -0000 Received: (qmail 12058 invoked by uid 22791); 21 Dec 2006 13:04:46 -0000 X-Spam-Check-By: sourceware.org Received: from nile.gnat.com (HELO nile.gnat.com) (205.232.38.5) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 21 Dec 2006 13:04:33 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-nile.gnat.com (Postfix) with ESMTP id E2B2D48CE84; Thu, 21 Dec 2006 08:04:31 -0500 (EST) Received: from nile.gnat.com ([127.0.0.1]) by localhost (nile.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 03659-01-10; Thu, 21 Dec 2006 08:04:31 -0500 (EST) Received: from takamaka.act-europe.fr (AStDenis-105-1-71-21.w80-8.abo.wanadoo.fr [80.8.210.21]) by nile.gnat.com (Postfix) with ESMTP id 044BA48D07A; Thu, 21 Dec 2006 08:04:31 -0500 (EST) Received: by takamaka.act-europe.fr (Postfix, from userid 1000) id CCA5F34C099; Thu, 21 Dec 2006 17:05:17 +0400 (RET) Date: Thu, 21 Dec 2006 13:04:00 -0000 From: Joel Brobecker To: Mark Kettenis Cc: Markus Deuling , GDB Patches Subject: Re: [RFA] gdbserver/server.c: Replace 2x strlen() by a variable Message-ID: <20061221130517.GH3640@adacore.com> References: <458A3B6C.2040803@de.ibm.com> <20061221110904.GG3640@adacore.com> <25093.192.87.1.22.1166705194.squirrel@webmail.xs4all.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <25093.192.87.1.22.1166705194.squirrel@webmail.xs4all.nl> User-Agent: Mutt/1.4.2.2i Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-12/txt/msg00288.txt.bz2 > > Actually, since the same string is duplicated a couple of times, > > I would also suggest declaring a constant string "QPassSignals:" > > and use the constant instead of risking a typo... How about: > > > > const char str[] = "QPassSignals:"; > > > > and then use "sizeof (str) - 1". Is that bad coding style? Otherwise, > > you can declare your sale constant: > > > > const int len = strlen (str); > > > > I am not reviewer, so these are just suggestions, not a request (JIC). > > I'm pretty sure GCC will optimize away the strlen("QPassSignals:") anyway, > so we really shouldn't try to obfuscate the code just to make it a bit > faster. So if optimization was the Markus' argument for making this > change I object to this change. How about avoiding the string duplication? Do you object to that too? This change seems like a good idea to me - although I agree that the risks of inconsistency are very small... -- Joel