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]

[FYI] Replace uses of concat with xstrdup


I noticed a couple of spots using concat that could use xstrdup
instead.  This patch fixes these.

gdb/ChangeLog
2019-06-16  Tom Tromey  <tom@tromey.com>

	* coffread.c (process_coff_symbol): Use xstrdup.
	* value.c (create_internalvar): Use xstrdup.
---
 gdb/ChangeLog  | 5 +++++
 gdb/coffread.c | 2 +-
 gdb/value.c    | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gdb/coffread.c b/gdb/coffread.c
index 8b31200545d..0c7c4b58b6f 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -1728,7 +1728,7 @@ process_coff_symbol (struct coff_symbol *cs,
 		&& *SYMBOL_LINKAGE_NAME (sym) != '~'
 		&& *SYMBOL_LINKAGE_NAME (sym) != '.')
 	      TYPE_NAME (SYMBOL_TYPE (sym)) =
-		concat (SYMBOL_LINKAGE_NAME (sym), (char *)NULL);
+		xstrdup (SYMBOL_LINKAGE_NAME (sym));
 
 	  add_symbol_to_list (sym, get_file_symbols ());
 	  break;
diff --git a/gdb/value.c b/gdb/value.c
index 71030efed07..1b22cf916e3 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -2025,7 +2025,7 @@ create_internalvar (const char *name)
 {
   struct internalvar *var = XNEW (struct internalvar);
 
-  var->name = concat (name, (char *)NULL);
+  var->name = xstrdup (name);
   var->kind = INTERNALVAR_VOID;
   var->next = internalvars;
   internalvars = var;
-- 
2.17.2


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