From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sourceware.org
Subject: [8/8] move obconcat out of symfile
Date: Fri, 11 Jan 2013 19:33:00 -0000 [thread overview]
Message-ID: <87ip73qzu6.fsf@fleche.redhat.com> (raw)
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 <tromey@redhat.com>
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;
\f
-/* 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
next reply other threads:[~2013-01-11 19:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-11 19:33 Tom Tromey [this message]
2013-01-11 20:34 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ip73qzu6.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox