@@ -117,7 +117,7 @@ void qemu_bh_delete(QEMUBH *bh)
bh->deleted = 1;
}
-static gboolean
+static int
aio_ctx_prepare(GSource *source, int *timeout)
{
AioContext *ctx = (AioContext *) source;
@@ -141,7 +141,7 @@ aio_ctx_prepare(GSource *source, int *timeout)
return false;
}
-static gboolean
+static int
aio_ctx_check(GSource *source)
{
AioContext *ctx = (AioContext *) source;
@@ -155,7 +155,7 @@ aio_ctx_check(GSource *source)
return aio_pending(ctx);
}
-static gboolean
+static int
aio_ctx_dispatch(GSource *source, GSourceFunc callback, void *user_data)
{
AioContext *ctx = (AioContext *) source;
@@ -66,7 +66,7 @@ struct FWCfgState {
static char *read_splashfile(char *filename, int *file_sizep, int *file_typep)
{
GError *err = NULL;
- gboolean res;
+ bool res;
char *content;
int file_type = -1;
unsigned int filehead = 0;
@@ -113,7 +113,7 @@ struct XenBlkDev {
int requests_finished;
/* Persistent grants extension */
- gboolean feature_persistent;
+ bool feature_persistent;
GTree *persistent_gnts;
unsigned int persistent_gnt_count;
unsigned int max_grants;
@@ -105,7 +105,7 @@ opts_start_struct(Visitor *v, void **obj, const char *kind,
}
-static gboolean
+static int
ghr_true(void *ign_key, void *ign_value, void *ign_user_data)
{
return TRUE;
@@ -88,7 +88,7 @@ static void qmp_input_push(QmpInputVisitor *qiv, QObject *obj, Error **errp)
}
/** Only for qmp_input_pop. */
-static gboolean always_true(void *key, void *val, void *user_pkey)
+static int always_true(void *key, void *val, void *user_pkey)
{
*(const char **)user_pkey = (const char *)key;
return TRUE;
@@ -1315,7 +1315,7 @@ static void dump_human_image_info_list(ImageInfoList *list)
}
}
-static gboolean str_equal_func(const void *a, const void *b)
+static int str_equal_func(const void *a, const void *b)
{
return strcmp(a, b) == 0;
}
@@ -25,8 +25,8 @@ struct GAChannel {
static int ga_channel_client_add(GAChannel *c, int fd);
-static gboolean ga_channel_listen_accept(GIOChannel *channel,
- GIOCondition condition, void *data)
+static int ga_channel_listen_accept(GIOChannel *channel,
+ GIOCondition condition, void *data)
{
GAChannel *c = data;
int ret, client_fd;
@@ -90,11 +90,11 @@ static void ga_channel_client_close(GAChannel *c)
}
}
-static gboolean ga_channel_client_event(GIOChannel *channel,
- GIOCondition condition, void *data)
+static int ga_channel_client_event(GIOChannel *channel,
+ GIOCondition condition, void *data)
{
GAChannel *c = data;
- gboolean client_cont;
+ bool client_cont;
g_assert(c);
if (c->event_cb) {
@@ -127,7 +127,8 @@ static int ga_channel_client_add(GAChannel *c, int fd)
return 0;
}
-static gboolean ga_channel_open(GAChannel *c, const char *path, GAChannelMethod method)
+static bool ga_channel_open(GAChannel *c, const char *path,
+ GAChannelMethod method)
{
int ret;
c->method = method;
@@ -38,7 +38,7 @@ typedef struct GAWatch {
* Called by glib prior to polling to set up poll events if polling is needed.
*
*/
-static gboolean ga_channel_prepare(GSource *source, int *timeout_ms)
+static int ga_channel_prepare(GSource *source, int *timeout_ms)
{
GAWatch *watch = (GAWatch *)source;
GAChannel *c = (GAChannel *)watch->channel;
@@ -95,7 +95,7 @@ out:
/*
* Called by glib after an outstanding read request is completed.
*/
-static gboolean ga_channel_check(GSource *source)
+static int ga_channel_check(GSource *source)
{
GAWatch *watch = (GAWatch *)source;
GAChannel *c = (GAChannel *)watch->channel;
@@ -152,13 +152,13 @@ static gboolean ga_channel_check(GSource *source)
/*
* Called by glib after either prepare or check routines signal readiness
*/
-static gboolean ga_channel_dispatch(GSource *source, GSourceFunc unused,
+static int ga_channel_dispatch(GSource *source, GSourceFunc unused,
void *user_data)
{
GAWatch *watch = (GAWatch *)source;
GAChannel *c = (GAChannel *)watch->channel;
GAChannelReadState *rs = &c->rstate;
- gboolean success;
+ bool success;
g_debug("dispatch");
success = c->cb(watch->pollfd.revents, c->user_data);
@@ -284,7 +284,7 @@ GIOStatus ga_channel_write_all(GAChannel *c, const char *buf, size_t size)
return status;
}
-static gboolean ga_channel_open(GAChannel *c, GAChannelMethod method,
+static bool ga_channel_open(GAChannel *c, GAChannelMethod method,
const char *path)
{
if (!method == GA_CHANNEL_VIRTIO_SERIAL) {
@@ -22,7 +22,7 @@ typedef enum {
GA_CHANNEL_UNIX_LISTEN,
} GAChannelMethod;
-typedef gboolean (*GAChannelCallback)(GIOCondition condition, void *opaque);
+typedef bool (*GAChannelCallback)(GIOCondition condition, void *opaque);
GAChannel *ga_channel_new(GAChannelMethod method, const char *path,
GAChannelCallback cb, void *opaque);
@@ -115,7 +115,7 @@ static void quit_handler(int sig)
}
#ifndef _WIN32
-static gboolean register_signal_handlers(void)
+static bool register_signal_handlers(void)
{
struct sigaction sigact;
int ret;
@@ -594,7 +594,7 @@ static void process_event(JSONMessageParser *parser, QList *tokens)
}
/* false return signals GAChannel to close the current client connection */
-static gboolean channel_event_cb(GIOCondition condition, void *data)
+static bool channel_event_cb(GIOCondition condition, void *data)
{
GAState *s = data;
char buf[QGA_READ_COUNT_DEFAULT+1];
@@ -636,7 +636,7 @@ static gboolean channel_event_cb(GIOCondition condition, void *data)
return true;
}
-static gboolean channel_init(GAState *s, const char *method, const char *path)
+static bool channel_init(GAState *s, const char *method, const char *path)
{
GAChannelMethod channel_method;
Despite its name, gboolean is an alias for int, *not* for _Bool. If you forget that, and compare gboolean values to TRUE, you're in trouble. Instead of blindly replacing gboolean by int, replace it by int exactly where that's needed for type-correctness, and by bool everywhere else. Signed-off-by: Markus Armbruster <armbru@redhat.com> --- async.c | 6 +++--- hw/fw_cfg.c | 2 +- hw/xen_disk.c | 2 +- qapi/opts-visitor.c | 2 +- qapi/qmp-input-visitor.c | 2 +- qemu-img.c | 2 +- qga/channel-posix.c | 13 +++++++------ qga/channel-win32.c | 10 +++++----- qga/channel.h | 2 +- qga/main.c | 6 +++--- 10 files changed, 24 insertions(+), 23 deletions(-)