mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-12-19 01:19:41 +08:00
Rewrite final cleanups
This patch rewrites final cleanups to use std::function and otherwise be more C++-ish.
This commit is contained in:
@@ -188,15 +188,6 @@ progressfn (debuginfod_client *c, long cur, long total)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Cleanup ARG, which is a debuginfod_client pointer. */
|
||||
|
||||
static void
|
||||
cleanup_debuginfod_client (void *arg)
|
||||
{
|
||||
debuginfod_client *client = static_cast<debuginfod_client *> (arg);
|
||||
debuginfod_end (client);
|
||||
}
|
||||
|
||||
/* Return a pointer to the single global debuginfod_client, initialising it
|
||||
first if needed. */
|
||||
|
||||
@@ -221,7 +212,10 @@ get_debuginfod_client ()
|
||||
handlers, which is too late.
|
||||
|
||||
So instead, we make use of GDB's final cleanup mechanism. */
|
||||
make_final_cleanup (cleanup_debuginfod_client, global_client);
|
||||
add_final_cleanup ([] ()
|
||||
{
|
||||
debuginfod_end (global_client);
|
||||
});
|
||||
debuginfod_set_progressfn (global_client, progressfn);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user