public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Use auto_obstack in windows-nat.c
@ 2022-04-04 19:59 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2022-04-04 19:59 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=04ae91ea5223735820f44d580055362b06a6df73

commit 04ae91ea5223735820f44d580055362b06a6df73
Author: Tom Tromey <tromey@adacore.com>
Date:   Thu Mar 31 09:45:23 2022 -0600

    Use auto_obstack in windows-nat.c
    
    One spot in windows-nat.c can use auto_obstack, removing some manual
    memory management.

Diff:
---
 gdb/windows-nat.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 1e34651a8ef..74f73614c47 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -2877,14 +2877,13 @@ windows_xfer_shared_libraries (struct target_ops *ops,
 			       ULONGEST offset, ULONGEST len,
 			       ULONGEST *xfered_len)
 {
-  struct obstack obstack;
+  auto_obstack obstack;
   const char *buf;
   LONGEST len_avail;
 
   if (writebuf)
     return TARGET_XFER_E_IO;
 
-  obstack_init (&obstack);
   obstack_grow_str (&obstack, "<library-list>\n");
   for (windows_solib &so : solibs)
     windows_xfer_shared_library (so.name.c_str (),
@@ -2904,7 +2903,6 @@ windows_xfer_shared_libraries (struct target_ops *ops,
       memcpy (readbuf, buf + offset, len);
     }
 
-  obstack_free (&obstack, NULL);
   *xfered_len = (ULONGEST) len;
   return len != 0 ? TARGET_XFER_OK : TARGET_XFER_EOF;
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-04 19:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-04 19:59 [binutils-gdb] Use auto_obstack in windows-nat.c Tom Tromey

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).