diff options
author | Tom Tromey <tromey@adacore.com> | 2024-04-10 11:48:13 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2024-04-15 11:45:33 -0600 |
commit | 12406b2cdab40fd05df65c4fe4aabaf4882fcc8e (patch) | |
tree | 18d3e87d9450ee498d254daddc1cedc21a34cdb2 /gdb/namespace.c | |
parent | 35d691515799a8cf7b82a1cb934dadb6a85b022f (diff) | |
download | gdb-12406b2cdab40fd05df65c4fe4aabaf4882fcc8e.zip gdb-12406b2cdab40fd05df65c4fe4aabaf4882fcc8e.tar.gz gdb-12406b2cdab40fd05df65c4fe4aabaf4882fcc8e.tar.bz2 |
Remove 'copy_names' parameter from add_using_directive
I noticed that add_using_directive's 'copy_names' parameter is only
used by a single caller. This patch removes the parameter and changes
that caller to copy the names itself. I chose to use intern here
since I suspect the names may well be repeated in a given objfile.
Approved-By: John Baldwin <jhb@FreeBSD.org>
Diffstat (limited to 'gdb/namespace.c')
-rw-r--r-- | gdb/namespace.c | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/gdb/namespace.c b/gdb/namespace.c index 231c7bd..5a9a99d 100644 --- a/gdb/namespace.c +++ b/gdb/namespace.c @@ -27,12 +27,11 @@ into the scope DEST. ALIAS is the name of the imported namespace in the current scope. If ALIAS is NULL then the namespace is known by its original name. DECLARATION is the name if the imported - variable if this is a declaration import (Eg. using A::x), otherwise - it is NULL. EXCLUDES is a list of names not to import from an - imported module or NULL. If COPY_NAMES is non-zero, then the - arguments are copied into newly allocated memory so they can be - temporaries. For EXCLUDES the contents of the vector are copied, - but the pointed to characters are not copied. */ + variable if this is a declaration import (Eg. using A::x), + otherwise it is NULL. EXCLUDES is a list of names not to import + from an imported module or NULL. For EXCLUDES the contents of the + vector are copied, but the pointed to characters are not + copied. */ void add_using_directive (struct using_direct **using_directives, @@ -42,7 +41,6 @@ add_using_directive (struct using_direct **using_directives, const char *declaration, const std::vector<const char *> &excludes, unsigned int decl_line, - int copy_names, struct obstack *obstack) { struct using_direct *current; @@ -90,26 +88,10 @@ add_using_directive (struct using_direct **using_directives, newobj = (struct using_direct *) obstack_alloc (obstack, alloc_len); memset (newobj, 0, sizeof (*newobj)); - if (copy_names) - { - newobj->import_src = obstack_strdup (obstack, src); - newobj->import_dest = obstack_strdup (obstack, dest); - } - else - { - newobj->import_src = src; - newobj->import_dest = dest; - } - - if (alias != NULL && copy_names) - newobj->alias = obstack_strdup (obstack, alias); - else - newobj->alias = alias; - - if (declaration != NULL && copy_names) - newobj->declaration = obstack_strdup (obstack, declaration); - else - newobj->declaration = declaration; + newobj->import_src = src; + newobj->import_dest = dest; + newobj->alias = alias; + newobj->declaration = declaration; if (!excludes.empty ()) memcpy (newobj->excludes, excludes.data (), |