mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
monitor error: Make printf()-like functions return a value
printf() & friends return the number of characters written on success, negative value on error. monitor_printf(), monitor_vfprintf(), monitor_vprintf(), error_printf(), error_printf_unless_qmp(), error_vprintf(), and error_vprintf_unless_qmp() return void. Some of them carry a TODO comment asking for int instead. Improve them to return int like printf() does. This makes our use of monitor_printf() as fprintf_function slightly less dirty: the function cast no longer adds a return value that isn't there. It still changes a parameter's pointer type. That will be addressed in a future commit. monitor_vfprintf() always returns zero. Improve it to return the proper value. Cc: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-Id: <20190417190641.26814-11-armbru@redhat.com>
This commit is contained in:
parent
26eaf2cd0d
commit
679cb8e1a1
5 changed files with 57 additions and 45 deletions
|
@ -28,9 +28,9 @@ void monitor_resume(Monitor *mon);
|
|||
int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp);
|
||||
int monitor_fd_param(Monitor *mon, const char *fdname, Error **errp);
|
||||
|
||||
void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
|
||||
int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
|
||||
GCC_FMT_ATTR(2, 0);
|
||||
void monitor_printf(Monitor *mon, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
|
||||
int monitor_printf(Monitor *mon, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
|
||||
int monitor_fprintf(FILE *stream, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
|
||||
void monitor_flush(Monitor *mon);
|
||||
int monitor_set_cpu(int cpu_index);
|
||||
|
@ -48,7 +48,7 @@ int monitor_fdset_dup_fd_add(int64_t fdset_id, int dup_fd);
|
|||
void monitor_fdset_dup_fd_remove(int dup_fd);
|
||||
int monitor_fdset_dup_fd_find(int dup_fd);
|
||||
|
||||
void monitor_vfprintf(FILE *stream,
|
||||
const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0);
|
||||
int monitor_vfprintf(FILE *stream,
|
||||
const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0);
|
||||
|
||||
#endif /* MONITOR_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue