public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@ericsson.com>
To: <gdb-patches@sourceware.org>
Cc: Simon Marchi <simon.marchi@ericsson.com>
Subject: [PATCH 10/10] Class-ify lm_info_windows
Date: Wed, 26 Apr 2017 22:53:00 -0000	[thread overview]
Message-ID: <20170426225139.313-10-simon.marchi@ericsson.com> (raw)
In-Reply-To: <20170426224706.27988-1-simon.marchi@ericsson.com>

This patch makes lm_info_windows a "real" class.  It initializes the field
and replaces XCNEW/xfree with new/delete.

gdb/ChangeLog:

	* windows-nat.c (struct lm_info_windows): Initialize field.
	(windows_make_so): Allocate lm_info_windows with new.
	(windows_free_so): Free lm_info_windows with delete.
---
 gdb/windows-nat.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index ef1c2914f1..c54c9ee5d5 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -587,7 +587,7 @@ struct safe_symbol_file_add_args
 /* Maintain a linked list of "so" information.  */
 struct lm_info_windows : public lm_info_base
 {
-  LPVOID load_addr;
+  LPVOID load_addr = 0;
 };
 
 static struct so_list solib_start, *solib_end;
@@ -645,7 +645,7 @@ windows_make_so (const char *name, LPVOID load_addr)
     }
 #endif
   so = XCNEW (struct so_list);
-  lm_info_windows *li = XCNEW (struct lm_info_windows);
+  lm_info_windows *li = new lm_info_windows;
   so->lm_info = li;
   li->load_addr = load_addr;
   strcpy (so->so_original_name, name);
@@ -784,8 +784,11 @@ handle_load_dll (void *dummy)
 static void
 windows_free_so (struct so_list *so)
 {
-  if (so->lm_info)
-    xfree (so->lm_info);
+  lm_info_windows *li = (lm_info_windows *) so->lm_info;
+
+  if (li != NULL)
+    delete li;
+
   xfree (so);
 }
 
-- 
2.11.0

  parent reply	other threads:[~2017-04-26 22:53 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-26 22:47 [PATCH 00/10] Make lm_info class hierarchy Simon Marchi
2017-04-26 22:47 ` [PATCH 03/10] Class-ify lm_info_aix Simon Marchi
2017-04-28 15:58   ` Pedro Alves
2017-04-26 22:47 ` [PATCH 04/10] Class-ify lm_info_dsbt Simon Marchi
2017-04-28 15:59   ` Pedro Alves
2017-04-28 20:57     ` Simon Marchi
2017-04-26 22:47 ` [PATCH 02/10] Make various lm_info implementations inherit from a base class Simon Marchi
2017-04-28 15:57   ` Pedro Alves
2017-04-26 22:47 ` [PATCH 01/10] Standardize darwin's lm_info Simon Marchi
2017-04-28 15:57   ` Pedro Alves
2017-04-28 19:32     ` Simon Marchi
2017-04-26 22:52 ` [PATCH 06/10] Class-ify lm_info_frv Simon Marchi
2017-04-28 15:59   ` Pedro Alves
2017-04-26 22:52 ` [PATCH 05/10] Fix indentation of lm_info_frv Simon Marchi
2017-04-28 15:59   ` Pedro Alves
2017-04-28 21:02     ` Simon Marchi
2017-04-26 22:53 ` [PATCH 07/10] Class-ify lm_info_target Simon Marchi
2017-04-28 16:00   ` Pedro Alves
2017-04-26 22:53 ` Simon Marchi [this message]
2017-04-28 16:01   ` [PATCH 10/10] Class-ify lm_info_windows Pedro Alves
2017-04-26 22:53 ` [PATCH 08/10] Class-ify lm_info_svr4 Simon Marchi
2017-04-28 16:00   ` Pedro Alves
2017-04-26 22:54 ` [PATCH 09/10] Class-ify lm_info_darwin Simon Marchi
2017-04-28 16:00   ` Pedro Alves
2017-04-28 21:13     ` Simon Marchi
2017-05-02 14:42       ` Pedro Alves
2017-04-28 16:08 ` [PATCH 00/10] Make lm_info class hierarchy Pedro Alves
2017-04-28 21:18   ` Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170426225139.313-10-simon.marchi@ericsson.com \
    --to=simon.marchi@ericsson.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).