mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-27 14:39:09 +08:00
gdb: change xml_fetch_another a function_view
The xml_fetch_another is currently a plain function pointer type, with a `void *` baton parameter. To improve type-safety, change this to a function_view. Any required data is captured by a lambda at the call site. gdb/ChangeLog: * xml-support.h (xml_fetch_another): Change type to be a function_view. (xml_process_xincludes): Remove baton parameter. (xml_fetch_content_from_file): Change baton parameter to dirname. * xml-support.c (struct xinclude_parsing_data) <xinclude_parsing_data>: Remove baton parameter. <fetcher_baton>: Remove. (xinclude_start_include): Adjust. (xml_process_xincludes): Adjust. (xml_fetch_content_from_file): Replace baton parameter with dirname. * xml-syscall.c (syscall_parse_xml): Remove baton parameter. (xml_init_syscalls_info): Use a lambda. * xml-tdesc.c (tdesc_parse_xml): Remove baton parameter. (file_read_description_xml): Use a lambda. (fetch_available_features_from_target): Change baton parameter to target_ops. (target_read_description_xml): Use a lambda. (target_fetch_description_xml): Use a lambda. (string_read_description_xml): Update. Change-Id: I7ba4b8f5e97fc6a952c6c20ccc3be92a06cc2bd2
This commit is contained in:

committed by
Simon Marchi

parent
b1766e7ce8
commit
8400a90d19
@ -287,8 +287,7 @@ static const struct gdb_xml_element syselements[] = {
|
||||
};
|
||||
|
||||
static struct syscalls_info *
|
||||
syscall_parse_xml (const char *document, xml_fetch_another fetcher,
|
||||
void *fetcher_baton)
|
||||
syscall_parse_xml (const char *document, xml_fetch_another fetcher)
|
||||
{
|
||||
struct syscall_parsing_data data;
|
||||
syscalls_info_up sysinfo (new syscalls_info ());
|
||||
@ -322,9 +321,13 @@ xml_init_syscalls_info (const char *filename)
|
||||
if (!full_file)
|
||||
return NULL;
|
||||
|
||||
return syscall_parse_xml (full_file->data (),
|
||||
xml_fetch_content_from_file,
|
||||
(void *) ldirname (filename).c_str ());
|
||||
const std::string dirname = ldirname (filename);
|
||||
auto fetch_another = [&dirname] (const char *name)
|
||||
{
|
||||
return xml_fetch_content_from_file (name, dirname.c_str ());
|
||||
};
|
||||
|
||||
return syscall_parse_xml (full_file->data (), fetch_another);
|
||||
}
|
||||
|
||||
/* Initializes the syscalls_info structure according to the
|
||||
|
Reference in New Issue
Block a user