diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2020-09-14 11:12:55 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2020-09-14 11:30:58 -0400 |
commit | 8400a90d19c5c53f7100421c688fb896789048b9 (patch) | |
tree | dbf3aff829ab551c14a040ac7717e187d7417300 /gdb/xml-syscall.c | |
parent | b1766e7ce88647c8002928aeb8a9f04048c494ae (diff) | |
download | gdb-8400a90d19c5c53f7100421c688fb896789048b9.zip gdb-8400a90d19c5c53f7100421c688fb896789048b9.tar.gz gdb-8400a90d19c5c53f7100421c688fb896789048b9.tar.bz2 |
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
Diffstat (limited to 'gdb/xml-syscall.c')
-rw-r--r-- | gdb/xml-syscall.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/gdb/xml-syscall.c b/gdb/xml-syscall.c index 8cca875..effb379 100644 --- a/gdb/xml-syscall.c +++ b/gdb/xml-syscall.c @@ -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 |