From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12655 invoked by alias); 26 Dec 2006 15:35:55 -0000 Received: (qmail 12645 invoked by uid 22791); 26 Dec 2006 15:35:54 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Tue, 26 Dec 2006 15:35:48 +0000 Received: from drow by nevyn.them.org with local (Exim 4.63) (envelope-from ) id 1GzEL4-0004Gi-2v; Tue, 26 Dec 2006 10:35:38 -0500 Date: Tue, 26 Dec 2006 15:35:00 -0000 From: Daniel Jacobowitz To: Joel Brobecker Cc: Mark Kettenis , Markus Deuling , GDB Patches Subject: Re: [RFA] gdbserver/server.c: Replace 2x strlen() by a variable Message-ID: <20061226153538.GB16188@nevyn.them.org> Mail-Followup-To: Joel Brobecker , Mark Kettenis , Markus Deuling , GDB Patches References: <458A3B6C.2040803@de.ibm.com> <20061221110904.GG3640@adacore.com> <25093.192.87.1.22.1166705194.squirrel@webmail.xs4all.nl> <20061221130517.GH3640@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20061221130517.GH3640@adacore.com> User-Agent: Mutt/1.5.13 (2006-08-11) X-IsSubscribed: yes 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/msg00326.txt.bz2 On Thu, Dec 21, 2006 at 05:05:17PM +0400, Joel Brobecker wrote: > > 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. Mark is correct, at least for recent versions of GCC. strlen of a constant string without embedded zeros is folded to sizeof the string minus one. > 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... If it makes the code harder to read, I do object. This, and similar motifs with hardcoded lengths instead of duplicated strlens, are all through that file. I was careful to keep the duplications close together so that they are easily visually confirmed. I don't want to have to hunt around for the code implementing a particular packet. If it makes the code easier to read somehow, I don't object - I'd have to see it. -- Daniel Jacobowitz CodeSourcery