From patchwork Fri Jun 8 02:57:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 27706 Received: (qmail 58917 invoked by alias); 8 Jun 2018 02:57:06 -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 58858 invoked by uid 89); 8 Jun 2018 02:57:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: gateway36.websitewelcome.com Received: from gateway36.websitewelcome.com (HELO gateway36.websitewelcome.com) (192.185.179.26) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 08 Jun 2018 02:57:04 +0000 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway36.websitewelcome.com (Postfix) with ESMTP id AC230400CF454 for ; Thu, 7 Jun 2018 21:57:03 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id R7aJftYLQBcCXR7aJfjwtp; Thu, 07 Jun 2018 21:57:03 -0500 X-Authority-Reason: nr=8 Received: from 75-166-19-45.hlrn.qwest.net ([75.166.19.45]:34926 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1fR7aJ-002GhJ-GM; Thu, 07 Jun 2018 21:57:03 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA] Remove a VEC from serial.c Date: Thu, 7 Jun 2018 20:57:01 -0600 Message-Id: <20180608025701.14713-1-tom@tromey.com> X-BWhitelist: no X-Source-L: No X-Exim-ID: 1fR7aJ-002GhJ-GM X-Source-Sender: 75-166-19-45.hlrn.qwest.net (bapiya.Home) [75.166.19.45]:34926 X-Source-Auth: tom+tromey.com X-Email-Count: 4 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes This replaces a VEC in serial.c with a std::vector. Tested by the buildbot. gdb/ChangeLog 2018-06-07 Tom Tromey * serial.c (serial_ops_p): Remove typedef. Don't declare VEC. (serial_ops_list): Now static, std::vector. (serial_interface_lookup, serial_add_interface): --- gdb/ChangeLog | 8 +++++++- gdb/serial.c | 12 +++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gdb/serial.c b/gdb/serial.c index 48fb02d913b..16308ab9c72 100644 --- a/gdb/serial.c +++ b/gdb/serial.c @@ -27,12 +27,9 @@ static unsigned int global_serial_debug_p; -typedef const struct serial_ops *serial_ops_p; -DEF_VEC_P (serial_ops_p); - /* Serial I/O handlers. */ -VEC (serial_ops_p) *serial_ops_list = NULL; +static std::vector serial_ops_list; /* Pointer to list of scb's. */ @@ -146,10 +143,7 @@ serial_log_command (struct target_ops *self, const char *cmd) static const struct serial_ops * serial_interface_lookup (const char *name) { - const struct serial_ops *ops; - int i; - - for (i = 0; VEC_iterate (serial_ops_p, serial_ops_list, i, ops); ++i) + for (const struct serial_ops *ops : serial_ops_list) if (strcmp (name, ops->name) == 0) return ops; @@ -159,7 +153,7 @@ serial_interface_lookup (const char *name) void serial_add_interface (const struct serial_ops *optable) { - VEC_safe_push (serial_ops_p, serial_ops_list, optable); + serial_ops_list.push_back (optable); } /* Return the open serial device for FD, if found, or NULL if FD is