mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
error: New convenience function error_report_err()
I've typed error_report("%s", error_get_pretty(ERR)) too many times already, and I've fixed too many instances of qerror_report_err(ERR) to error_report("%s", error_get_pretty(ERR)) as well. Capture the pattern in a convenience function. Since it's almost invariably followed by error_free(), stuff that into the convenience function as well. The next patch will put it to use. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
248337e178
commit
2ee2f1e415
2 changed files with 11 additions and 0 deletions
|
@ -152,6 +152,12 @@ const char *error_get_pretty(Error *err)
|
|||
return err->msg;
|
||||
}
|
||||
|
||||
void error_report_err(Error *err)
|
||||
{
|
||||
error_report("%s", error_get_pretty(err));
|
||||
error_free(err);
|
||||
}
|
||||
|
||||
void error_free(Error *err)
|
||||
{
|
||||
if (err) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue