diff options
author | Tom Tromey <tromey@redhat.com> | 2009-03-19 17:39:31 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2009-03-19 17:39:31 +0000 |
commit | 16ad93705cfed2630f48ba44b7dde9d20a4c6f44 (patch) | |
tree | df8e80ba0e4c5e9b74d0a1ff99638d1fd0fc478b /gdb | |
parent | 55f25fc330f3b22081bb4748b0f6c2009567512d (diff) | |
download | gdb-16ad93705cfed2630f48ba44b7dde9d20a4c6f44.zip gdb-16ad93705cfed2630f48ba44b7dde9d20a4c6f44.tar.gz gdb-16ad93705cfed2630f48ba44b7dde9d20a4c6f44.tar.bz2 |
* utils.c (do_obstack_free): New function.
(make_cleanup_obstack_free): Likewise.
* defs.h (make_cleanup_obstack_free): Declare.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/defs.h | 3 | ||||
-rw-r--r-- | gdb/utils.c | 17 |
3 files changed, 26 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b96ecc3..107396e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2009-03-19 Tom Tromey <tromey@redhat.com> + + * utils.c (do_obstack_free): New function. + (make_cleanup_obstack_free): Likewise. + * defs.h (make_cleanup_obstack_free): Declare. + 2009-03-18 Doug Evans <dje@google.com> * linux-nat.c (linux_nat_find_memory_regions): Result of PIDGET is an @@ -366,6 +366,9 @@ extern struct cleanup *make_cleanup_fclose (FILE *file); extern struct cleanup *make_cleanup_bfd_close (bfd *abfd); +struct obstack; +extern struct cleanup *make_cleanup_obstack_free (struct obstack *obstack); + extern struct cleanup *make_cleanup_restore_integer (int *variable); extern struct cleanup *make_final_cleanup (make_cleanup_ftype *, void *); diff --git a/gdb/utils.c b/gdb/utils.c index 9224839..0becfd9 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -271,6 +271,23 @@ make_cleanup_fclose (FILE *file) return make_cleanup (do_fclose_cleanup, file); } +/* Helper function which does the work for make_cleanup_obstack_free. */ + +static void +do_obstack_free (void *arg) +{ + struct obstack *ob = arg; + obstack_free (ob, NULL); +} + +/* Return a new cleanup that frees OBSTACK. */ + +struct cleanup * +make_cleanup_obstack_free (struct obstack *obstack) +{ + return make_cleanup (do_obstack_free, obstack); +} + static void do_ui_file_delete (void *arg) { |