From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10079 invoked by alias); 30 Apr 2010 18:38:59 -0000 Received: (qmail 10068 invoked by uid 22791); 30 Apr 2010 18:38:58 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 30 Apr 2010 18:38:53 +0000 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o3UIcpEa012033 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 30 Apr 2010 14:38:51 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o3UIcp6m005543; Fri, 30 Apr 2010 14:38:51 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o3UIcoZr027725; Fri, 30 Apr 2010 14:38:50 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id DBB7B3795F9; Fri, 30 Apr 2010 12:38:49 -0600 (MDT) From: Tom Tromey To: Jan Kratochvil Cc: gdb-patches@sourceware.org Subject: Re: [patch 1/3] Make obconcat use stdarg References: <20100430181605.GA19190@host0.dyn.jankratochvil.net> Reply-To: tromey@redhat.com Date: Fri, 30 Apr 2010 18:38:00 -0000 In-Reply-To: <20100430181605.GA19190@host0.dyn.jankratochvil.net> (Jan Kratochvil's message of "Fri, 30 Apr 2010 20:16:05 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2010-04/txt/msg01012.txt.bz2 >>>>> "Jan" == Jan Kratochvil writes: Jan> __attribute__ ((sentinel)) availability for gcc >= 4.0 I have copied from Jan> . It roughly matches the GCC ChangeLog dates. Jan> Still I find this patch as a code cleanup. I agree. Jan> +obconcat (struct obstack *obstackp, ...) Jan> +{ Jan> + va_list ap; Jan> + size_t len = 1; Jan> + char *retval, *dest; Jan> + Jan> + va_start (ap, obstackp); Jan> + for (;;) Jan> + { Jan> + const char *s = va_arg (ap, const char *); Jan> + Jan> + if (s == NULL) Jan> + break; Jan> + len += strlen (s); Jan> + } Jan> + va_end (ap); I think it is better to just do the copying in a single loop. Obstacks already handle growing objects well enough, there's no need to work around this. Personally I think this function would be better placed in util.c, but that isn't a requirement for patch. Tom