From 577978cb2287ff24442c03efbf4adc8adc3c9b9a Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Thu, 05 Oct 2017 19:40:38 -0400 Subject: MqConfig: Propagate const qualification through callbacks --- diff --git a/src/config.c b/src/config.c index 6074773..e8497d2 100644 --- a/src/config.c +++ b/src/config.c @@ -38,10 +38,10 @@ enum type { }; union callback { - void (*boolean_cb)(const gchar *, gboolean, gpointer); - void (*integer_cb)(const gchar *, gint, gpointer); - void (*double_cb)(const gchar *, gdouble, gpointer); - void (*string_cb)(const gchar *, gchar *, gpointer); + void (*boolean_cb)(const gchar *, const gboolean, gpointer); + void (*integer_cb)(const gchar *, const gint, gpointer); + void (*double_cb)(const gchar *, const gdouble, gpointer); + void (*string_cb)(const gchar *, const gchar *, gpointer); }; struct callbacks { @@ -283,8 +283,8 @@ mq_config_get_string(MqConfig *config, const gchar *name) } static void -set_type_or_run_callbacks(MqConfig *config, const gchar *name, gpointer value, - enum type type) +set_type_or_run_callbacks(MqConfig *config, const gchar *name, + gconstpointer value, enum type type) { struct item *item; struct callbacks *cbs; @@ -301,22 +301,22 @@ set_type_or_run_callbacks(MqConfig *config, const gchar *name, gpointer value, switch (item->type) { case TYPE_BOOLEAN: cbs->cb.boolean_cb(name, - *((gboolean *) value), + *((const gboolean *) value), cbs->user_data); break; case TYPE_INTEGER: cbs->cb.integer_cb(name, - *((gint *) value), + *((const gint *) value), cbs->user_data); break; case TYPE_DOUBLE: cbs->cb.double_cb(name, - *((gdouble *) value), + *((const gdouble *) value), cbs->user_data); break; case TYPE_STRING: cbs->cb.string_cb(name, - (gchar *) value, + (const gchar *) value, cbs->user_data); break; } -- cgit v0.9.1