diff mbox

[1/3] Purge the silly GLib "Basic Types", except for gboolean

Message ID 1358525049-31163-2-git-send-email-armbru@redhat.com
State New
Headers show

Commit Message

Markus Armbruster Jan. 18, 2013, 4:04 p.m. UTC
GLib chooses to define aliases for a whole bunch of bog-standard C
names.  GLib's documentation justifies them by "ease-of-use and
portability".  Baloney.  Aliases for standar types are no more
portable than the standard types themselves.  And if you const void *
so hard to use that you need to muddle the waters with an alias, I'd
prefer you'd break some other code base instead of QEMU.

The following GLib aliases have crept into our code:

    gboolean        int
    gpointer        void *
    gconstpointer   const void *
    gchar           char
    guchar          unsigned char
    gint            int
    guint           unsigned
    glong           long
    gdouble         double
    gsize           size_t
    G_MAXSIZE       SIZE_MAX
    gintptr         int *

Purge them all except for gboolean, which gets its own commit because
it's even sillier than the others.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 async.c                            |  6 ++----
 coroutine-gthread.c                |  8 ++++----
 hw/9pfs/virtio-9p-coth.c           |  2 +-
 hw/fw_cfg.c                        |  4 ++--
 hw/qdev-monitor.c                  |  2 +-
 hw/qdev.c                          |  4 ++--
 hw/xen_disk.c                      |  4 ++--
 include/qom/object.h               |  8 ++++----
 main-loop.c                        |  2 +-
 qapi/opts-visitor.c                |  8 ++++----
 qapi/qmp-input-visitor.c           |  4 ++--
 qemu-img.c                         |  4 ++--
 qga/channel-posix.c                | 18 +++++++++---------
 qga/channel-win32.c                | 18 +++++++++---------
 qga/channel.h                      | 10 +++++-----
 qga/commands-posix.c               |  6 +++---
 qga/commands.c                     |  2 +-
 qga/guest-agent-command-state.c    |  4 ++--
 qga/guest-agent-core.h             |  2 +-
 qga/main.c                         | 14 +++++++-------
 qom/container.c                    |  2 +-
 qom/object.c                       | 26 +++++++++++++-------------
 qtest.c                            |  8 ++++----
 target-alpha/cpu.c                 |  4 ++--
 target-arm/cpu.c                   |  2 +-
 target-arm/helper.c                |  4 ++--
 target-i386/cpu.c                  |  2 +-
 target-m68k/helper.c               |  4 ++--
 target-openrisc/cpu.c              |  4 ++--
 target-ppc/translate_init.c        | 12 ++++++------
 tests/libqtest.c                   | 20 ++++++++++----------
 tests/test-visitor-serialization.c | 12 ++++++------
 trace/simple.c                     |  8 ++++----
 vl.c                               |  6 +++---
 34 files changed, 121 insertions(+), 123 deletions(-)
diff mbox

Patch

diff --git a/async.c b/async.c
index 72d268a..8c4ec5b 100644
--- a/async.c
+++ b/async.c
@@ -118,7 +118,7 @@  void qemu_bh_delete(QEMUBH *bh)
 }
 
 static gboolean
-aio_ctx_prepare(GSource *source, gint    *timeout)
+aio_ctx_prepare(GSource *source, int *timeout)
 {
     AioContext *ctx = (AioContext *) source;
     QEMUBH *bh;
@@ -156,9 +156,7 @@  aio_ctx_check(GSource *source)
 }
 
 static gboolean
-aio_ctx_dispatch(GSource     *source,
-                 GSourceFunc  callback,
-                 gpointer     user_data)
+aio_ctx_dispatch(GSource *source, GSourceFunc callback, void *user_data)
 {
     AioContext *ctx = (AioContext *) source;
 
diff --git a/coroutine-gthread.c b/coroutine-gthread.c
index d3e5b99..373d8c0 100644
--- a/coroutine-gthread.c
+++ b/coroutine-gthread.c
@@ -50,7 +50,7 @@  static inline void init_coroutine_cond(void)
  * thread exit / coroutine key update using the free_on_thread_exit
  * field.
  */
-static void coroutine_destroy_notify(gpointer data)
+static void coroutine_destroy_notify(void *data)
 {
     CoroutineGThread *co = data;
     if (co && co->free_on_thread_exit) {
@@ -76,7 +76,7 @@  static inline void set_coroutine_key(CoroutineGThread *co,
     g_private_replace(&coroutine_key, co);
 }
 
-static inline GThread *create_thread(GThreadFunc func, gpointer data)
+static inline GThread *create_thread(GThreadFunc func, void *data)
 {
     return g_thread_new("coroutine", func, data);
 }
@@ -104,7 +104,7 @@  static inline void set_coroutine_key(CoroutineGThread *co,
                          free_on_thread_exit ? (GDestroyNotify)g_free : NULL);
 }
 
-static inline GThread *create_thread(GThreadFunc func, gpointer data)
+static inline GThread *create_thread(GThreadFunc func, void *data)
 {
     return g_thread_create_full(func, data, 0, TRUE, TRUE,
                                 G_THREAD_PRIORITY_NORMAL, NULL);
@@ -141,7 +141,7 @@  static void coroutine_wait_runnable(CoroutineGThread *co)
     g_static_mutex_unlock(&coroutine_lock);
 }
 
-static gpointer coroutine_thread(gpointer opaque)
+static void *coroutine_thread(void *opaque)
 {
     CoroutineGThread *co = opaque;
 
diff --git a/hw/9pfs/virtio-9p-coth.c b/hw/9pfs/virtio-9p-coth.c
index ae6cde8..1475b00 100644
--- a/hw/9pfs/virtio-9p-coth.c
+++ b/hw/9pfs/virtio-9p-coth.c
@@ -41,7 +41,7 @@  static void v9fs_qemu_process_req_done(void *arg)
     }
 }
 
-static void v9fs_thread_routine(gpointer data, gpointer user_data)
+static void v9fs_thread_routine(void *data, void *user_data)
 {
     ssize_t len;
     char byte = 0;
diff --git a/hw/fw_cfg.c b/hw/fw_cfg.c
index 7c9480c..b5d6df9 100644
--- a/hw/fw_cfg.c
+++ b/hw/fw_cfg.c
@@ -67,12 +67,12 @@  static char *read_splashfile(char *filename, int *file_sizep, int *file_typep)
 {
     GError *err = NULL;
     gboolean res;
-    gchar *content;
+    char *content;
     int file_type = -1;
     unsigned int filehead = 0;
     int bmp_bpp;
 
-    res = g_file_get_contents(filename, &content, (gsize *)file_sizep, &err);
+    res = g_file_get_contents(filename, &content, (size_t *)file_sizep, &err);
     if (res == FALSE) {
         error_report("failed to read splash file '%s'", filename);
         g_error_free(err);
diff --git a/hw/qdev-monitor.c b/hw/qdev-monitor.c
index 93283ee..ee14446 100644
--- a/hw/qdev-monitor.c
+++ b/hw/qdev-monitor.c
@@ -474,7 +474,7 @@  DeviceState *qdev_device_add(QemuOpts *opts)
                                   OBJECT(qdev), NULL);
     } else {
         static int anon_count;
-        gchar *name = g_strdup_printf("device[%d]", anon_count++);
+        char *name = g_strdup_printf("device[%d]", anon_count++);
         object_property_add_child(qdev_get_peripheral_anon(), name,
                                   OBJECT(qdev), NULL);
         g_free(name);
diff --git a/hw/qdev.c b/hw/qdev.c
index 9761016..49610ab 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -567,7 +567,7 @@  static void qdev_set_legacy_property(Object *obj, Visitor *v, void *opaque,
 void qdev_property_add_legacy(DeviceState *dev, Property *prop,
                               Error **errp)
 {
-    gchar *name, *type;
+    char *name, *type;
 
     /* Register pointer properties as legacy properties */
     if (!prop->info->print && !prop->info->parse &&
@@ -653,7 +653,7 @@  static void device_set_realized(Object *obj, bool value, Error **err)
 
         if (!obj->parent && local_err == NULL) {
             static int unattached_count;
-            gchar *name = g_strdup_printf("device[%d]", unattached_count++);
+            char *name = g_strdup_printf("device[%d]", unattached_count++);
 
             object_property_add_child(container_get(qdev_get_machine(),
                                                     "/unattached"),
diff --git a/hw/xen_disk.c b/hw/xen_disk.c
index 7fea871..1037a80 100644
--- a/hw/xen_disk.c
+++ b/hw/xen_disk.c
@@ -151,14 +151,14 @@  static void ioreq_reset(struct ioreq *ioreq)
     qemu_iovec_reset(&ioreq->v);
 }
 
-static gint int_cmp(gconstpointer a, gconstpointer b, gpointer user_data)
+static int int_cmp(const void *a, const void *b, void *user_data)
 {
     uint ua = GPOINTER_TO_UINT(a);
     uint ub = GPOINTER_TO_UINT(b);
     return (ua > ub) - (ua < ub);
 }
 
-static void destroy_grant(gpointer pgnt)
+static void destroy_grant(void *pgnt)
 {
     PersistentGrant *grant = pgnt;
     XenGnttab gnt = grant->blkdev->xendev.gnttabdev;
diff --git a/include/qom/object.h b/include/qom/object.h
index 1ef2f0e..8e4ffca 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -219,8 +219,8 @@  typedef void (ObjectPropertyRelease)(Object *obj,
 
 typedef struct ObjectProperty
 {
-    gchar *name;
-    gchar *type;
+    char *name;
+    char *type;
     ObjectPropertyAccessor *get;
     ObjectPropertyAccessor *set;
     ObjectPropertyRelease *release;
@@ -842,7 +842,7 @@  Object *object_get_root(void);
  * Returns: The canonical path for a object.  This is the path within the
  * composition tree starting from the root.
  */
-gchar *object_get_canonical_path(Object *obj);
+char *object_get_canonical_path(Object *obj);
 
 /**
  * object_resolve_path:
@@ -900,7 +900,7 @@  Object *object_resolve_path_type(const char *path, const char *typename,
  *
  * Returns: The resolved object or NULL on path lookup failure.
  */
-Object *object_resolve_path_component(Object *parent, const gchar *part);
+Object *object_resolve_path_component(Object *parent, const char *part);
 
 /**
  * object_property_add_child:
diff --git a/main-loop.c b/main-loop.c
index 6f52ac3..5f22537 100644
--- a/main-loop.c
+++ b/main-loop.c
@@ -333,7 +333,7 @@  static int os_host_main_loop_wait(uint32_t timeout)
     int select_ret, g_poll_ret, ret, i;
     PollingEntry *pe;
     WaitObjects *w = &wait_objects;
-    gint poll_timeout;
+    int poll_timeout;
     static struct timeval tv0;
 
     /* XXX: need to suppress polling by better using win32 events */
diff --git a/qapi/opts-visitor.c b/qapi/opts-visitor.c
index 174bd8b..590561a 100644
--- a/qapi/opts-visitor.c
+++ b/qapi/opts-visitor.c
@@ -47,7 +47,7 @@  struct OptsVisitor
 
 
 static void
-destroy_list(gpointer list)
+destroy_list(void *list)
 {
   g_queue_free(list);
 }
@@ -66,11 +66,11 @@  opts_visitor_insert(GHashTable *unprocessed_opts, const QemuOpt *opt)
          * "key_destroy_func" in opts_start_struct(). Thus cast away key
          * const-ness in order to suppress gcc's warning.
          */
-        g_hash_table_insert(unprocessed_opts, (gpointer)opt->name, list);
+        g_hash_table_insert(unprocessed_opts, (void *)opt->name, list);
     }
 
     /* Similarly, destroy_list() doesn't call g_queue_free_full(). */
-    g_queue_push_tail(list, (gpointer)opt);
+    g_queue_push_tail(list, (void *)opt);
 }
 
 
@@ -106,7 +106,7 @@  opts_start_struct(Visitor *v, void **obj, const char *kind,
 
 
 static gboolean
-ghr_true(gpointer ign_key, gpointer ign_value, gpointer ign_user_data)
+ghr_true(void *ign_key, void *ign_value, void *ign_user_data)
 {
     return TRUE;
 }
diff --git a/qapi/qmp-input-visitor.c b/qapi/qmp-input-visitor.c
index 67fb127..bac1ed3 100644
--- a/qapi/qmp-input-visitor.c
+++ b/qapi/qmp-input-visitor.c
@@ -62,7 +62,7 @@  static QObject *qmp_input_get_object(QmpInputVisitor *qiv,
 static void qdict_add_key(const char *key, QObject *obj, void *opaque)
 {
     GHashTable *h = opaque;
-    g_hash_table_insert(h, (gpointer) key, NULL);
+    g_hash_table_insert(h, (void *) key, NULL);
 }
 
 static void qmp_input_push(QmpInputVisitor *qiv, QObject *obj, Error **errp)
@@ -88,7 +88,7 @@  static void qmp_input_push(QmpInputVisitor *qiv, QObject *obj, Error **errp)
 }
 
 /** Only for qmp_input_pop. */
-static gboolean always_true(gpointer key, gpointer val, gpointer user_pkey)
+static gboolean always_true(void *key, void *val, void *user_pkey)
 {
     *(const char **)user_pkey = (const char *)key;
     return TRUE;
diff --git a/qemu-img.c b/qemu-img.c
index 85d3740..7637411 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -1315,7 +1315,7 @@  static void dump_human_image_info_list(ImageInfoList *list)
     }
 }
 
-static gboolean str_equal_func(gconstpointer a, gconstpointer b)
+static gboolean str_equal_func(const void *a, const void *b)
 {
     return strcmp(a, b) == 0;
 }
@@ -1352,7 +1352,7 @@  static ImageInfoList *collect_image_info_list(const char *filename,
                          filename);
             goto err;
         }
-        g_hash_table_insert(filenames, (gpointer)filename, NULL);
+        g_hash_table_insert(filenames, (void *)filename, NULL);
 
         bs = bdrv_new_open(filename, fmt, BDRV_O_FLAGS | BDRV_O_NO_BACKING,
                            false);
diff --git a/qga/channel-posix.c b/qga/channel-posix.c
index e65dda3..7ce8de0 100644
--- a/qga/channel-posix.c
+++ b/qga/channel-posix.c
@@ -20,13 +20,13 @@  struct GAChannel {
     GIOChannel *client_channel;
     GAChannelMethod method;
     GAChannelCallback event_cb;
-    gpointer user_data;
+    void *user_data;
 };
 
 static int ga_channel_client_add(GAChannel *c, int fd);
 
 static gboolean ga_channel_listen_accept(GIOChannel *channel,
-                                         GIOCondition condition, gpointer data)
+                                         GIOCondition condition, void *data)
 {
     GAChannel *c = data;
     int ret, client_fd;
@@ -91,7 +91,7 @@  static void ga_channel_client_close(GAChannel *c)
 }
 
 static gboolean ga_channel_client_event(GIOChannel *channel,
-                                        GIOCondition condition, gpointer data)
+                                        GIOCondition condition, void *data)
 {
     GAChannel *c = data;
     gboolean client_cont;
@@ -127,7 +127,7 @@  static int ga_channel_client_add(GAChannel *c, int fd)
     return 0;
 }
 
-static gboolean ga_channel_open(GAChannel *c, const gchar *path, GAChannelMethod method)
+static gboolean ga_channel_open(GAChannel *c, const char *path, GAChannelMethod method)
 {
     int ret;
     c->method = method;
@@ -210,10 +210,10 @@  static gboolean ga_channel_open(GAChannel *c, const gchar *path, GAChannelMethod
     return true;
 }
 
-GIOStatus ga_channel_write_all(GAChannel *c, const gchar *buf, gsize size)
+GIOStatus ga_channel_write_all(GAChannel *c, const char *buf, size_t size)
 {
     GError *err = NULL;
-    gsize written = 0;
+    size_t written = 0;
     GIOStatus status = G_IO_STATUS_NORMAL;
 
     while (size) {
@@ -241,13 +241,13 @@  GIOStatus ga_channel_write_all(GAChannel *c, const gchar *buf, gsize size)
     return status;
 }
 
-GIOStatus ga_channel_read(GAChannel *c, gchar *buf, gsize size, gsize *count)
+GIOStatus ga_channel_read(GAChannel *c, char *buf, size_t size, size_t *count)
 {
     return g_io_channel_read_chars(c->client_channel, buf, size, count, NULL);
 }
 
-GAChannel *ga_channel_new(GAChannelMethod method, const gchar *path,
-                          GAChannelCallback cb, gpointer opaque)
+GAChannel *ga_channel_new(GAChannelMethod method, const char *path,
+                          GAChannelCallback cb, void *opaque)
 {
     GAChannel *c = g_malloc0(sizeof(GAChannel));
     c->event_cb = cb;
diff --git a/qga/channel-win32.c b/qga/channel-win32.c
index 16bf44a..e5e375a 100644
--- a/qga/channel-win32.c
+++ b/qga/channel-win32.c
@@ -9,7 +9,7 @@ 
 #include "qga/channel.h"
 
 typedef struct GAChannelReadState {
-    guint thread_id;
+    unsigned thread_id;
     uint8_t *buf;
     size_t buf_size;
     size_t cur; /* current buffer start */
@@ -21,7 +21,7 @@  typedef struct GAChannelReadState {
 struct GAChannel {
     HANDLE handle;
     GAChannelCallback cb;
-    gpointer user_data;
+    void *user_data;
     GAChannelReadState rstate;
     GIOCondition pending_events; /* TODO: use GAWatch.pollfd.revents */
     GSource *source;
@@ -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, gint *timeout_ms)
+static gboolean ga_channel_prepare(GSource *source, int *timeout_ms)
 {
     GAWatch *watch = (GAWatch *)source;
     GAChannel *c = (GAChannel *)watch->channel;
@@ -153,7 +153,7 @@  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,
-                                    gpointer user_data)
+                                    void *user_data)
 {
     GAWatch *watch = (GAWatch *)source;
     GAChannel *c = (GAChannel *)watch->channel;
@@ -196,13 +196,13 @@  static GSource *ga_channel_create_watch(GAChannel *c)
     GAWatch *watch = (GAWatch *)source;
 
     watch->channel = c;
-    watch->pollfd.fd = (gintptr) c->rstate.ov.hEvent;
+    watch->pollfd.fd = (int *) c->rstate.ov.hEvent;
     g_source_add_poll(source, &watch->pollfd);
 
     return source;
 }
 
-GIOStatus ga_channel_read(GAChannel *c, char *buf, size_t size, gsize *count)
+GIOStatus ga_channel_read(GAChannel *c, char *buf, size_t size, size_t *count)
 {
     GAChannelReadState *rs = &c->rstate;
     GIOStatus status;
@@ -285,7 +285,7 @@  GIOStatus ga_channel_write_all(GAChannel *c, const char *buf, size_t size)
 }
 
 static gboolean ga_channel_open(GAChannel *c, GAChannelMethod method,
-                                const gchar *path)
+                                const char *path)
 {
     if (!method == GA_CHANNEL_VIRTIO_SERIAL) {
         g_critical("unsupported communication method");
@@ -303,8 +303,8 @@  static gboolean ga_channel_open(GAChannel *c, GAChannelMethod method,
     return true;
 }
 
-GAChannel *ga_channel_new(GAChannelMethod method, const gchar *path,
-                          GAChannelCallback cb, gpointer opaque)
+GAChannel *ga_channel_new(GAChannelMethod method, const char *path,
+                          GAChannelCallback cb, void *opaque)
 {
     GAChannel *c = g_malloc0(sizeof(GAChannel));
     SECURITY_ATTRIBUTES sec_attrs;
diff --git a/qga/channel.h b/qga/channel.h
index 3704ea9..494ef91 100644
--- a/qga/channel.h
+++ b/qga/channel.h
@@ -22,12 +22,12 @@  typedef enum {
     GA_CHANNEL_UNIX_LISTEN,
 } GAChannelMethod;
 
-typedef gboolean (*GAChannelCallback)(GIOCondition condition, gpointer opaque);
+typedef gboolean (*GAChannelCallback)(GIOCondition condition, void *opaque);
 
-GAChannel *ga_channel_new(GAChannelMethod method, const gchar *path,
-                          GAChannelCallback cb, gpointer opaque);
+GAChannel *ga_channel_new(GAChannelMethod method, const char *path,
+                          GAChannelCallback cb, void *opaque);
 void ga_channel_free(GAChannel *c);
-GIOStatus ga_channel_read(GAChannel *c, gchar *buf, gsize size, gsize *count);
-GIOStatus ga_channel_write_all(GAChannel *c, const gchar *buf, gsize size);
+GIOStatus ga_channel_read(GAChannel *c, char *buf, size_t size, size_t *count);
+GIOStatus ga_channel_write_all(GAChannel *c, const char *buf, size_t size);
 
 #endif
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 77f6ee7..3136a8c 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -214,7 +214,7 @@  struct GuestFileRead *qmp_guest_file_read(int64_t handle, bool has_count,
 {
     GuestFileHandle *gfh = guest_file_handle_find(handle, err);
     GuestFileRead *read_data = NULL;
-    guchar *buf;
+    unsigned char *buf;
     FILE *fh;
     size_t read_count;
 
@@ -255,8 +255,8 @@  GuestFileWrite *qmp_guest_file_write(int64_t handle, const char *buf_b64,
                                      bool has_count, int64_t count, Error **err)
 {
     GuestFileWrite *write_data = NULL;
-    guchar *buf;
-    gsize buf_len;
+    unsigned char *buf;
+    size_t buf_len;
     int write_count;
     GuestFileHandle *gfh = guest_file_handle_find(handle, err);
     FILE *fh;
diff --git a/qga/commands.c b/qga/commands.c
index 7ffb35e..4dca315 100644
--- a/qga/commands.c
+++ b/qga/commands.c
@@ -20,7 +20,7 @@ 
  * to log for accounting purposes, check ga_logging_enabled() beforehand,
  * and use the QERR_QGA_LOGGING_DISABLED to generate an error
  */
-void slog(const gchar *fmt, ...)
+void slog(const char *fmt, ...)
 {
     va_list ap;
 
diff --git a/qga/guest-agent-command-state.c b/qga/guest-agent-command-state.c
index 969da23..c30df1c 100644
--- a/qga/guest-agent-command-state.c
+++ b/qga/guest-agent-command-state.c
@@ -33,7 +33,7 @@  void ga_command_state_add(GACommandState *cs,
     cs->groups = g_slist_append(cs->groups, cg);
 }
 
-static void ga_command_group_init(gpointer opaque, gpointer unused)
+static void ga_command_group_init(void *opaque, void *unused)
 {
     GACommandGroup *cg = opaque;
 
@@ -49,7 +49,7 @@  void ga_command_state_init_all(GACommandState *cs)
     g_slist_foreach(cs->groups, ga_command_group_init, NULL);
 }
 
-static void ga_command_group_cleanup(gpointer opaque, gpointer unused)
+static void ga_command_group_cleanup(void *opaque, void *unused)
 {
     GACommandGroup *cg = opaque;
 
diff --git a/qga/guest-agent-core.h b/qga/guest-agent-core.h
index 3354598..3a4c947 100644
--- a/qga/guest-agent-core.h
+++ b/qga/guest-agent-core.h
@@ -29,7 +29,7 @@  GACommandState *ga_command_state_new(void);
 bool ga_logging_enabled(GAState *s);
 void ga_disable_logging(GAState *s);
 void ga_enable_logging(GAState *s);
-void slog(const gchar *fmt, ...);
+void slog(const char *fmt, ...);
 void ga_set_response_delimited(GAState *s);
 bool ga_is_frozen(GAState *s);
 void ga_set_frozen(GAState *s);
diff --git a/qga/main.c b/qga/main.c
index db281a5..2c551a6 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -230,8 +230,8 @@  void ga_enable_logging(GAState *s)
     s->logging_enabled = true;
 }
 
-static void ga_log(const gchar *domain, GLogLevelFlags level,
-                   const gchar *msg, gpointer opaque)
+static void ga_log(const char *domain, GLogLevelFlags level,
+                   const char *msg, void *opaque)
 {
     GAState *s = opaque;
     GTimeVal time;
@@ -314,7 +314,7 @@  static bool ga_open_pidfile(const char *pidfile)
 }
 #endif
 
-static gint ga_strcmp(gconstpointer str1, gconstpointer str2)
+static int ga_strcmp(const void *str1, const void *str2)
 {
     return strcmp(str1, str2);
 }
@@ -594,11 +594,11 @@  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, gpointer data)
+static gboolean channel_event_cb(GIOCondition condition, void *data)
 {
     GAState *s = data;
-    gchar buf[QGA_READ_COUNT_DEFAULT+1];
-    gsize count;
+    char buf[QGA_READ_COUNT_DEFAULT+1];
+    size_t count;
     GError *err = NULL;
     GIOStatus status = ga_channel_read(s->channel, buf, QGA_READ_COUNT_DEFAULT, &count);
     if (err != NULL) {
@@ -636,7 +636,7 @@  static gboolean channel_event_cb(GIOCondition condition, gpointer data)
     return true;
 }
 
-static gboolean channel_init(GAState *s, const gchar *method, const gchar *path)
+static gboolean channel_init(GAState *s, const char *method, const char *path)
 {
     GAChannelMethod channel_method;
 
diff --git a/qom/container.c b/qom/container.c
index 62b1648..c8e652a 100644
--- a/qom/container.c
+++ b/qom/container.c
@@ -28,7 +28,7 @@  static void container_register_types(void)
 Object *container_get(Object *root, const char *path)
 {
     Object *obj, *child;
-    gchar **parts;
+    char **parts;
     int i;
 
     parts = g_strsplit(path, "/", 0);
diff --git a/qom/object.c b/qom/object.c
index 03e6f24..8fbfff4 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -540,8 +540,8 @@  typedef struct OCFData
     void *opaque;
 } OCFData;
 
-static void object_class_foreach_tramp(gpointer key, gpointer value,
-                                       gpointer opaque)
+static void object_class_foreach_tramp(void *key, void *value,
+                                       void *opaque)
 {
     OCFData *data = opaque;
     TypeImpl *type = value;
@@ -868,7 +868,7 @@  static void object_get_child_property(Object *obj, Visitor *v, void *opaque,
                                       const char *name, Error **errp)
 {
     Object *child = opaque;
-    gchar *path;
+    char *path;
 
     path = object_get_canonical_path(child);
     visit_type_str(v, &path, name, errp);
@@ -886,7 +886,7 @@  static void object_finalize_child_property(Object *obj, const char *name,
 void object_property_add_child(Object *obj, const char *name,
                                Object *child, Error **errp)
 {
-    gchar *type;
+    char *type;
 
     type = g_strdup_printf("child<%s>", object_get_typename(OBJECT(child)));
 
@@ -904,14 +904,14 @@  static void object_get_link_property(Object *obj, Visitor *v, void *opaque,
                                      const char *name, Error **errp)
 {
     Object **child = opaque;
-    gchar *path;
+    char *path;
 
     if (*child) {
         path = object_get_canonical_path(*child);
         visit_type_str(v, &path, name, errp);
         g_free(path);
     } else {
-        path = (gchar *)"";
+        path = (char *)"";
         visit_type_str(v, &path, name, errp);
     }
 }
@@ -924,7 +924,7 @@  static void object_set_link_property(Object *obj, Visitor *v, void *opaque,
     bool ambiguous = false;
     const char *type;
     char *path;
-    gchar *target_type;
+    char *target_type;
 
     type = object_property_get_type(obj, name, NULL);
 
@@ -967,7 +967,7 @@  void object_property_add_link(Object *obj, const char *name,
                               const char *type, Object **child,
                               Error **errp)
 {
-    gchar *full_type;
+    char *full_type;
 
     full_type = g_strdup_printf("link<%s>", type);
 
@@ -979,7 +979,7 @@  void object_property_add_link(Object *obj, const char *name,
     g_free(full_type);
 }
 
-gchar *object_get_canonical_path(Object *obj)
+char *object_get_canonical_path(Object *obj)
 {
     Object *root = object_get_root();
     char *newpath = NULL, *path = NULL;
@@ -1017,7 +1017,7 @@  gchar *object_get_canonical_path(Object *obj)
     return newpath;
 }
 
-Object *object_resolve_path_component(Object *parent, const gchar *part)
+Object *object_resolve_path_component(Object *parent, const char *part)
 {
     ObjectProperty *prop = object_property_find(parent, part, NULL);
     if (prop == NULL) {
@@ -1034,7 +1034,7 @@  Object *object_resolve_path_component(Object *parent, const gchar *part)
 }
 
 static Object *object_resolve_abs_path(Object *parent,
-                                          gchar **parts,
+                                          char **parts,
                                           const char *typename,
                                           int index)
 {
@@ -1057,7 +1057,7 @@  static Object *object_resolve_abs_path(Object *parent,
 }
 
 static Object *object_resolve_partial_path(Object *parent,
-                                              gchar **parts,
+                                              char **parts,
                                               const char *typename,
                                               bool *ambiguous)
 {
@@ -1098,7 +1098,7 @@  Object *object_resolve_path_type(const char *path, const char *typename,
 {
     bool partial_path = true;
     Object *obj;
-    gchar **parts;
+    char **parts;
 
     parts = g_strsplit(path, "/", 0);
     if (parts == NULL || parts[0] == NULL) {
diff --git a/qtest.c b/qtest.c
index c9b58ce..b865ab5 100644
--- a/qtest.c
+++ b/qtest.c
@@ -187,9 +187,9 @@  static void qtest_irq_handler(void *opaque, int n, int level)
     }
 }
 
-static void qtest_process_command(CharDriverState *chr, gchar **words)
+static void qtest_process_command(CharDriverState *chr, char **words)
 {
-    const gchar *command;
+    const char *command;
 
     g_assert(words);
 
@@ -357,7 +357,7 @@  static void qtest_process_inbuf(CharDriverState *chr, GString *inbuf)
     while ((end = strchr(inbuf->str, '\n')) != NULL) {
         size_t offset;
         GString *cmd;
-        gchar **words;
+        char **words;
 
         offset = end - inbuf->str;
 
@@ -376,7 +376,7 @@  static void qtest_read(void *opaque, const uint8_t *buf, int size)
 {
     CharDriverState *chr = opaque;
 
-    g_string_append_len(inbuf, (const gchar *)buf, size);
+    g_string_append_len(inbuf, (const char *)buf, size);
     qtest_process_inbuf(chr, inbuf);
 }
 
diff --git a/target-alpha/cpu.c b/target-alpha/cpu.c
index 40e9809..049ce02 100644
--- a/target-alpha/cpu.c
+++ b/target-alpha/cpu.c
@@ -32,7 +32,7 @@  static void alpha_cpu_realize(Object *obj, Error **errp)
 }
 
 /* Sort alphabetically by type name. */
-static gint alpha_cpu_list_compare(gconstpointer a, gconstpointer b)
+static int alpha_cpu_list_compare(const void *a, const void *b)
 {
     ObjectClass *class_a = (ObjectClass *)a;
     ObjectClass *class_b = (ObjectClass *)b;
@@ -43,7 +43,7 @@  static gint alpha_cpu_list_compare(gconstpointer a, gconstpointer b)
     return strcmp(name_a, name_b);
 }
 
-static void alpha_cpu_list_entry(gpointer data, gpointer user_data)
+static void alpha_cpu_list_entry(void *data, void *user_data)
 {
     ObjectClass *oc = data;
     CPUListState *s = user_data;
diff --git a/target-arm/cpu.c b/target-arm/cpu.c
index 07588a1..69ac1a2 100644
--- a/target-arm/cpu.c
+++ b/target-arm/cpu.c
@@ -25,7 +25,7 @@ 
 #endif
 #include "sysemu/sysemu.h"
 
-static void cp_reg_reset(gpointer key, gpointer value, gpointer opaque)
+static void cp_reg_reset(void *key, void *value, void *opaque)
 {
     /* Reset a single ARMCPRegInfo register */
     ARMCPRegInfo *ri = value;
diff --git a/target-arm/helper.c b/target-arm/helper.c
index 37c34a1..ac1f9b3 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -1293,7 +1293,7 @@  ARMCPU *cpu_arm_init(const char *cpu_model)
 }
 
 /* Sort alphabetically by type name, except for "any". */
-static gint arm_cpu_list_compare(gconstpointer a, gconstpointer b)
+static int arm_cpu_list_compare(const void *a, const void *b)
 {
     ObjectClass *class_a = (ObjectClass *)a;
     ObjectClass *class_b = (ObjectClass *)b;
@@ -1310,7 +1310,7 @@  static gint arm_cpu_list_compare(gconstpointer a, gconstpointer b)
     }
 }
 
-static void arm_cpu_list_entry(gpointer data, gpointer user_data)
+static void arm_cpu_list_entry(void *data, void *user_data)
 {
     ObjectClass *oc = data;
     CPUListState *s = user_data;
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 333745b..97ba197 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1585,7 +1585,7 @@  int cpu_x86_register(X86CPU *cpu, const char *cpu_model)
     x86_def_t def1, *def = &def1;
     Error *error = NULL;
     char *name, *features;
-    gchar **model_pieces;
+    char **model_pieces;
 
     memset(def, 0, sizeof(*def));
 
diff --git a/target-m68k/helper.c b/target-m68k/helper.c
index 097fc78..c2c2847 100644
--- a/target-m68k/helper.c
+++ b/target-m68k/helper.c
@@ -26,7 +26,7 @@ 
 #define SIGNBIT (1u << 31)
 
 /* Sort alphabetically, except for "any". */
-static gint m68k_cpu_list_compare(gconstpointer a, gconstpointer b)
+static int m68k_cpu_list_compare(const void *a, const void *b)
 {
     ObjectClass *class_a = (ObjectClass *)a;
     ObjectClass *class_b = (ObjectClass *)b;
@@ -43,7 +43,7 @@  static gint m68k_cpu_list_compare(gconstpointer a, gconstpointer b)
     }
 }
 
-static void m68k_cpu_list_entry(gpointer data, gpointer user_data)
+static void m68k_cpu_list_entry(void *data, void *user_data)
 {
     ObjectClass *c = data;
     CPUListState *s = user_data;
diff --git a/target-openrisc/cpu.c b/target-openrisc/cpu.c
index 56544d8..b902de8 100644
--- a/target-openrisc/cpu.c
+++ b/target-openrisc/cpu.c
@@ -176,7 +176,7 @@  typedef struct OpenRISCCPUList {
 } OpenRISCCPUList;
 
 /* Sort alphabetically by type name, except for "any". */
-static gint openrisc_cpu_list_compare(gconstpointer a, gconstpointer b)
+static int openrisc_cpu_list_compare(const void *a, const void *b)
 {
     ObjectClass *class_a = (ObjectClass *)a;
     ObjectClass *class_b = (ObjectClass *)b;
@@ -193,7 +193,7 @@  static gint openrisc_cpu_list_compare(gconstpointer a, gconstpointer b)
     }
 }
 
-static void openrisc_cpu_list_entry(gpointer data, gpointer user_data)
+static void openrisc_cpu_list_entry(void *data, void *user_data)
 {
     ObjectClass *oc = data;
     OpenRISCCPUList *s = user_data;
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 3f199c4..f8c8ec9 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -10234,7 +10234,7 @@  static void ppc_cpu_realize(Object *obj, Error **errp)
 #endif
 }
 
-static gint ppc_cpu_compare_class_pvr(gconstpointer a, gconstpointer b)
+static int ppc_cpu_compare_class_pvr(const void *a, const void *b)
 {
     ObjectClass *oc = (ObjectClass *)a;
     uint32_t pvr = *(uint32_t *)b;
@@ -10264,7 +10264,7 @@  PowerPCCPUClass *ppc_cpu_class_by_pvr(uint32_t pvr)
     return pcc;
 }
 
-static gint ppc_cpu_compare_class_name(gconstpointer a, gconstpointer b)
+static int ppc_cpu_compare_class_name(const void *a, const void *b)
 {
     ObjectClass *oc = (ObjectClass *)a;
     const char *name = b;
@@ -10354,7 +10354,7 @@  PowerPCCPU *cpu_ppc_init(const char *cpu_model)
 }
 
 /* Sort by PVR, ordering special case "host" last. */
-static gint ppc_cpu_list_compare(gconstpointer a, gconstpointer b)
+static int ppc_cpu_list_compare(const void *a, const void *b)
 {
     ObjectClass *oc_a = (ObjectClass *)a;
     ObjectClass *oc_b = (ObjectClass *)b;
@@ -10379,7 +10379,7 @@  static gint ppc_cpu_list_compare(gconstpointer a, gconstpointer b)
     }
 }
 
-static void ppc_cpu_list_entry(gpointer data, gpointer user_data)
+static void ppc_cpu_list_entry(void *data, void *user_data)
 {
     ObjectClass *oc = data;
     CPUListState *s = user_data;
@@ -10403,7 +10403,7 @@  void ppc_cpu_list(FILE *f, fprintf_function cpu_fprintf)
     g_slist_free(list);
 }
 
-static void ppc_cpu_defs_entry(gpointer data, gpointer user_data)
+static void ppc_cpu_defs_entry(void *data, void *user_data)
 {
     ObjectClass *oc = data;
     CpuDefinitionInfoList **first = user_data;
@@ -10450,7 +10450,7 @@  static void ppc_cpu_register_model(const ppc_def_t *def)
 
     type_info.name = g_strdup_printf("%s-" TYPE_POWERPC_CPU, def->name),
     type_register(&type_info);
-    g_free((gpointer)type_info.name);
+    g_free((void *)type_info.name);
 }
 
 /* CPUClass::reset() */
diff --git a/tests/libqtest.c b/tests/libqtest.c
index 913fa05..4ec3b6f 100644
--- a/tests/libqtest.c
+++ b/tests/libqtest.c
@@ -39,7 +39,7 @@  struct QTestState
     int qmp_fd;
     bool irq_level[MAX_IRQ];
     GString *rx;
-    gchar *pid_file;
+    char *pid_file;
     char *socket_path, *qmp_socket_path;
 };
 
@@ -105,8 +105,8 @@  QTestState *qtest_init(const char *extra_args)
 {
     QTestState *s;
     int sock, qmpsock, ret, i;
-    gchar *pid_file;
-    gchar *command;
+    char *pid_file;
+    char *command;
     const char *qemu_binary;
     pid_t pid;
 
@@ -179,7 +179,7 @@  void qtest_quit(QTestState *s)
 
 static void socket_sendf(int fd, const char *fmt, va_list ap)
 {
-    gchar *str;
+    char *str;
     size_t size, offset;
 
     str = g_strdup_vprintf(fmt, ap);
@@ -240,10 +240,10 @@  static GString *qtest_recv_line(QTestState *s)
     return line;
 }
 
-static gchar **qtest_rsp(QTestState *s, int expected_args)
+static char **qtest_rsp(QTestState *s, int expected_args)
 {
     GString *line;
-    gchar **words;
+    char **words;
     int i;
 
 redo:
@@ -341,7 +341,7 @@  bool qtest_get_irq(QTestState *s, int num)
 
 static int64_t qtest_clock_rsp(QTestState *s)
 {
-    gchar **words;
+    char **words;
     int64_t clock;
     words = qtest_rsp(s, 2);
     clock = g_ascii_strtoll(words[1], NULL, 0);
@@ -402,7 +402,7 @@  void qtest_outl(QTestState *s, uint16_t addr, uint32_t value)
 
 static uint32_t qtest_in(QTestState *s, const char *cmd, uint16_t addr)
 {
-    gchar **args;
+    char **args;
     uint32_t value;
 
     qtest_sendf(s, "%s 0x%x\n", cmd, addr);
@@ -444,7 +444,7 @@  static int hex2nib(char ch)
 void qtest_memread(QTestState *s, uint64_t addr, void *data, size_t size)
 {
     uint8_t *ptr = data;
-    gchar **args;
+    char **args;
     size_t i;
 
     qtest_sendf(s, "read 0x%" PRIx64 " 0x%zx\n", addr, size);
@@ -460,7 +460,7 @@  void qtest_memread(QTestState *s, uint64_t addr, void *data, size_t size)
 
 void qtest_add_func(const char *str, void (*fn))
 {
-    gchar *path = g_strdup_printf("/%s/%s", qtest_get_arch(), str);
+    char *path = g_strdup_printf("/%s/%s", qtest_get_arch(), str);
     g_test_add_func(path, fn);
 }
 
diff --git a/tests/test-visitor-serialization.c b/tests/test-visitor-serialization.c
index 3c6b8df..256019b 100644
--- a/tests/test-visitor-serialization.c
+++ b/tests/test-visitor-serialization.c
@@ -230,17 +230,17 @@  typedef struct TestArgs {
 } TestArgs;
 
 #define FLOAT_STRING_PRECISION 6 /* corresponding to n in %.nf formatting */
-static gsize calc_float_string_storage(double value)
+static size_t calc_float_string_storage(double value)
 {
     int whole_value = value;
-    gsize i = 0;
+    size_t i = 0;
     do {
         i++;
     } while (whole_value /= 10);
     return i + 2 + FLOAT_STRING_PRECISION;
 }
 
-static void test_primitives(gconstpointer opaque)
+static void test_primitives(const void *opaque)
 {
     TestArgs *args = (TestArgs *) opaque;
     const SerializeOps *ops = args->ops;
@@ -277,7 +277,7 @@  static void test_primitives(gconstpointer opaque)
     g_free(args);
 }
 
-static void test_struct(gconstpointer opaque)
+static void test_struct(const void *opaque)
 {
     TestArgs *args = (TestArgs *) opaque;
     const SerializeOps *ops = args->ops;
@@ -299,7 +299,7 @@  static void test_struct(gconstpointer opaque)
     g_free(args);
 }
 
-static void test_nested_struct(gconstpointer opaque)
+static void test_nested_struct(const void *opaque)
 {
     TestArgs *args = (TestArgs *) opaque;
     const SerializeOps *ops = args->ops;
@@ -321,7 +321,7 @@  static void test_nested_struct(gconstpointer opaque)
     g_free(args);
 }
 
-static void test_nested_struct_list(gconstpointer opaque)
+static void test_nested_struct_list(const void *opaque)
 {
     TestArgs *args = (TestArgs *) opaque;
     const SerializeOps *ops = args->ops;
diff --git a/trace/simple.c b/trace/simple.c
index ce17d64..b6da5d3 100644
--- a/trace/simple.c
+++ b/trace/simple.c
@@ -152,7 +152,7 @@  static void wait_for_trace_records_available(void)
     g_static_mutex_unlock(&trace_lock);
 }
 
-static gpointer writeout_thread(gpointer opaque)
+static void *writeout_thread(void *opaque)
 {
     TraceRecord *recordptr;
     union {
@@ -173,7 +173,7 @@  static gpointer writeout_thread(gpointer opaque)
             dropped.rec.reserved = 0;
             while (1) {
                 dropped_count = dropped_events;
-                if (g_atomic_int_compare_and_exchange((gint *)&dropped_events,
+                if (g_atomic_int_compare_and_exchange((int *)&dropped_events,
                                                       dropped_count, 0)) {
                     break;
                 }
@@ -220,11 +220,11 @@  int trace_record_start(TraceBufferRecord *rec, TraceEventID event, size_t datasi
 
         if (new_idx - writeout_idx > TRACE_BUF_LEN) {
             /* Trace Buffer Full, Event dropped ! */
-            g_atomic_int_inc((gint *)&dropped_events);
+            g_atomic_int_inc((int *)&dropped_events);
             return -ENOSPC;
         }
 
-        if (g_atomic_int_compare_and_exchange((gint *)&trace_idx,
+        if (g_atomic_int_compare_and_exchange((int *)&trace_idx,
                                               old_idx, new_idx)) {
             break;
         }
diff --git a/vl.c b/vl.c
index 8ce2b10..56ac268 100644
--- a/vl.c
+++ b/vl.c
@@ -2641,21 +2641,21 @@  static const QEMUOption *lookup_opt(int argc, char **argv,
     return popt;
 }
 
-static gpointer malloc_and_trace(gsize n_bytes)
+static void *malloc_and_trace(size_t n_bytes)
 {
     void *ptr = malloc(n_bytes);
     trace_g_malloc(n_bytes, ptr);
     return ptr;
 }
 
-static gpointer realloc_and_trace(gpointer mem, gsize n_bytes)
+static void *realloc_and_trace(void *mem, size_t n_bytes)
 {
     void *ptr = realloc(mem, n_bytes);
     trace_g_realloc(mem, n_bytes, ptr);
     return ptr;
 }
 
-static void free_and_trace(gpointer mem)
+static void free_and_trace(void *mem)
 {
     trace_g_free(mem);
     free(mem);