* cli/cli-script.c (do_fclose_cleanup): Remove.

(script_from_file): Use make_cleanup_fclose.
	* xml-tdesc.c (do_cleanup_fclose): Remove.
	(fetch_xml_from_file): Use make_cleanup_fclose.
	* tracepoint.c (tracepoint_save_command): Use
	make_cleanup_fclose.  Always free pathname.
	* source.c (print_source_lines_base): Use make_cleanup_fclose.
	* remote.c (fclose_cleanup): Remove.
	(remote_file_put): Use make_cleanup_fclose.
	(remote_file_get): Likewise.
	* linux-nat.c (linux_nat_find_memory_regions): Use
	make_cleanup_fclose.
	(linux_nat_info_proc_cmd): Likewise.
	(linux_proc_pending_signals): Likewise.
	* fbsd-nat.c (fbsd_find_memory_regions): Use make_cleanup_fclose.
	Free file name.
	* cli/cli-dump.c (do_fclose_cleanup): Remove.
	(make_cleanup_fclose): Remove.
	* defs.h (make_cleanup_fclose): Declare.
	* utils.c (do_fclose_cleanup): New function.
	(make_cleanup_fclose): Likewise.
This commit is contained in:
Tom Tromey
2008-10-28 15:22:13 +00:00
parent 0f3e7e3c00
commit 7c8a8b0498
11 changed files with 73 additions and 47 deletions

View File

@@ -255,6 +255,23 @@ make_cleanup_close (int fd)
return make_cleanup (do_close_cleanup, saved_fd);
}
/* Helper function which does the work for make_cleanup_fclose. */
static void
do_fclose_cleanup (void *arg)
{
FILE *file = arg;
fclose (arg);
}
/* Return a new cleanup that closes FILE. */
struct cleanup *
make_cleanup_fclose (FILE *file)
{
return make_cleanup (do_fclose_cleanup, file);
}
static void
do_ui_file_delete (void *arg)
{