mirror of
https://github.com/yuzu-mirror/unicorn.git
synced 2026-04-04 14:07:42 +00:00
string-input-visitor: Favor new visit_free() function
Now that we have a polymorphic visit_free(), we no longer need string_input_visitor_cleanup(); which in turn means we no longer need to return a subtype from string_input_visitor_new() nor a public upcast function. Backports commit 7a0525c7be6b38d32d586e3fd12e7377ded21faa from qemu
This commit is contained in:
parent
7f741a6c9b
commit
e88a7e260b
3 changed files with 9 additions and 24 deletions
|
|
@ -304,26 +304,16 @@ static void parse_optional(Visitor *v, const char *name, bool *present)
|
|||
*present = true;
|
||||
}
|
||||
|
||||
Visitor *string_input_get_visitor(StringInputVisitor *v)
|
||||
{
|
||||
return &v->visitor;
|
||||
}
|
||||
|
||||
static void string_input_free(Visitor *v)
|
||||
{
|
||||
StringInputVisitor *siv = to_siv(v);
|
||||
|
||||
string_input_visitor_cleanup(siv);
|
||||
g_list_foreach(siv->ranges, free_range, NULL);
|
||||
g_list_free(siv->ranges);
|
||||
g_free(siv);
|
||||
}
|
||||
|
||||
void string_input_visitor_cleanup(StringInputVisitor *v)
|
||||
{
|
||||
g_list_foreach(v->ranges, free_range, NULL);
|
||||
g_list_free(v->ranges);
|
||||
g_free(v);
|
||||
}
|
||||
|
||||
StringInputVisitor *string_input_visitor_new(const char *str)
|
||||
Visitor *string_input_visitor_new(const char *str)
|
||||
{
|
||||
StringInputVisitor *v;
|
||||
|
||||
|
|
@ -343,5 +333,5 @@ StringInputVisitor *string_input_visitor_new(const char *str)
|
|||
v->visitor.free = string_input_free;
|
||||
|
||||
v->string = str;
|
||||
return v;
|
||||
return &v->visitor;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue