This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[8/8] move obconcat out of symfile


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;
 
 
-/* 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]