From patchwork Wed Feb 19 18:08:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 38234 Received: (qmail 80360 invoked by alias); 19 Feb 2020 18:08:38 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 80256 invoked by uid 89); 19 Feb 2020 18:08:38 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=HContent-Transfer-Encoding:8bit X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 19 Feb 2020 18:08:36 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 301E056058; Wed, 19 Feb 2020 13:08:35 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id uFyPrLoNZbvL; Wed, 19 Feb 2020 13:08:35 -0500 (EST) Received: from murgatroyd.Home (75-166-123-50.hlrn.qwest.net [75.166.123.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id DF2DE56056; Wed, 19 Feb 2020 13:08:34 -0500 (EST) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [pushed] Use obstack_strdup in ada-lang.c Date: Wed, 19 Feb 2020 11:08:33 -0700 Message-Id: <20200219180833.3351-1-tromey@adacore.com> MIME-Version: 1.0 I happened across a spot that was still using obstack_alloc and strcpy, rather than obstack_strdup. This patch makes the obvious fix. gdb/ChangeLog 2020-02-19 Tom Tromey * ada-lang.c (cache_symbol): Use obstack_strdup. --- gdb/ChangeLog | 4 ++++ gdb/ada-lang.c | 5 +---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index c5b5fdf169f..316eaf50b9a 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -4710,7 +4710,6 @@ cache_symbol (const char *name, domain_enum domain, struct symbol *sym, struct ada_symbol_cache *sym_cache = ada_get_symbol_cache (current_program_space); int h; - char *copy; struct cache_entry *e; /* Symbols for builtin types don't have a block. @@ -4733,9 +4732,7 @@ cache_symbol (const char *name, domain_enum domain, struct symbol *sym, e = XOBNEW (&sym_cache->cache_space, cache_entry); e->next = sym_cache->root[h]; sym_cache->root[h] = e; - e->name = copy - = (char *) obstack_alloc (&sym_cache->cache_space, strlen (name) + 1); - strcpy (copy, name); + e->name = obstack_strdup (&sym_cache->cache_space, name); e->sym = sym; e->domain = domain; e->block = block;