From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12664 invoked by alias); 11 Jan 2013 19:33:49 -0000 Received: (qmail 12654 invoked by uid 22791); 11 Jan 2013 19:33:48 -0000 X-SWARE-Spam-Status: No, hits=-6.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_YM 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, 11 Jan 2013 19:33:39 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0BJXdkv019595 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 11 Jan 2013 14:33:39 -0500 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r0BJXbma004140 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 11 Jan 2013 14:33:38 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Subject: [8/8] move obconcat out of symfile Date: Fri, 11 Jan 2013 19:33:00 -0000 Message-ID: <87ip73qzu6.fsf@fleche.redhat.com> MIME-Version: 1.0 Content-Type: text/plain 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: 2013-01/txt/msg00248.txt.bz2 Right now obconcat is declared in symfile.h and defined in symfile.c. I found this pretty surprising -- actually I only tripped over it by accident. This patch moves the declaration to gdb_obstack.h and the definition to utils.c. Let me know what you think. Tom >From aa195bdf593adc632dccab7df6d4fa433b91c66e Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 11 Jan 2013 11:50:43 -0700 Subject: [PATCH 8/8] move obconcat to utils.c and gdb_obstack.h * gdb_obstack.h (obconcat): Move declaration here, from... * symfile.h (obconcat): ... here. * utils.c (obconcat): Move definition here, from... * symfile.c (obconcat): ... here. --- gdb/gdb_obstack.h | 7 +++++++ gdb/symfile.c | 26 -------------------------- gdb/symfile.h | 7 ------- gdb/utils.c | 26 ++++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/gdb/gdb_obstack.h b/gdb/gdb_obstack.h index 96196b7..1459ee9 100644 --- a/gdb/gdb_obstack.h +++ b/gdb/gdb_obstack.h @@ -51,4 +51,11 @@ #define obstack_grow_wstr(OBSTACK, WSTRING) \ obstack_grow (OBSTACK, WSTRING, sizeof (gdb_wchar_t) * gdb_wcslen (WSTRING)) +/* Concatenate NULL terminated variable argument list of `const char + *' strings; return the new string. Space is found in the OBSTACKP. + Argument list must be terminated by a sentinel expression `(char *) + NULL'. */ + +extern char *obconcat (struct obstack *obstackp, ...) ATTRIBUTE_SENTINEL; + #endif diff --git a/gdb/symfile.c b/gdb/symfile.c index f610e67..2f87260 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -151,32 +151,6 @@ static VEC (sym_fns_ptr) *symtab_fns = NULL; int auto_solib_add = 1; -/* Concatenate NULL terminated variable argument list of `const char *' - strings; return the new string. Space is found in the OBSTACKP. - Argument list must be terminated by a sentinel expression `(char *) - NULL'. */ - -char * -obconcat (struct obstack *obstackp, ...) -{ - va_list ap; - - va_start (ap, obstackp); - for (;;) - { - const char *s = va_arg (ap, const char *); - - if (s == NULL) - break; - - obstack_grow_str (obstackp, s); - } - va_end (ap); - obstack_1grow (obstackp, 0); - - return obstack_finish (obstackp); -} - /* True if we are reading a symbol table. */ int currently_reading_symtab = 0; diff --git a/gdb/symfile.h b/gdb/symfile.h index ad9a4e2..8caec8e 100644 --- a/gdb/symfile.h +++ b/gdb/symfile.h @@ -506,13 +506,6 @@ extern struct section_addr_info extern void free_section_addr_info (struct section_addr_info *); -/* Concatenate NULL terminated variable argument list of `const char - *' strings; return the new string. Space is found in the OBSTACKP. - Argument list must be terminated by a sentinel expression `(char *) - NULL'. */ - -extern char *obconcat (struct obstack *obstackp, ...) ATTRIBUTE_SENTINEL; - /* Variables */ /* If non-zero, shared library symbols will be added automatically diff --git a/gdb/utils.c b/gdb/utils.c index e12888f..3f96625 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -3421,6 +3421,32 @@ dummy_obstack_deallocate (void *object, void *data) return; } +/* Concatenate NULL terminated variable argument list of `const char *' + strings; return the new string. Space is found in the OBSTACKP. + Argument list must be terminated by a sentinel expression `(char *) + NULL'. */ + +char * +obconcat (struct obstack *obstackp, ...) +{ + va_list ap; + + va_start (ap, obstackp); + for (;;) + { + const char *s = va_arg (ap, const char *); + + if (s == NULL) + break; + + obstack_grow_str (obstackp, s); + } + va_end (ap); + obstack_1grow (obstackp, 0); + + return obstack_finish (obstackp); +} + /* The bit offset of the highest byte in a ULONGEST, for overflow checking. */ -- 1.7.7.6