summaryrefslogtreecommitdiff
path: root/gio/src/settings.ccg
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2023-03-27 15:20:04 +0200
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2023-03-27 15:20:04 +0200
commitb7ad9b86d70003c065606c563578cc66dcd2ce0a (patch)
tree264e2c4723ba49647707a71b04c778f2e5b30124 /gio/src/settings.ccg
parentd3874b1ec56d6db6b393e94daa1aded0f94d4b8b (diff)
downloadglibmm-b7ad9b86d70003c065606c563578cc66dcd2ce0a.tar.gz
Gio: Use callback functions with C linkage
* gio/giomm/socketsource.cc: Add extern "C". * gio/src/application.[ccg|hg]: Call Application_Class::open_callback() via a local function with C linkage. * gio/src/asyncinitable.[ccg|hg]: Call AsyncInitable_Class::init_async_vfunc_callback() and init_finish_vfunc_callback() via local functions with C linkage. * gio/src/dbusobjectmanagerclient.ccg: Use a local function with C linkage instead of Glib::destroy_notify_delete<SlotProxyType>. * gio/src/file.ccg: Add extern "C". * gio/src/liststore.ccg: Add a TODO comment. * gio/src/memoryinputstream.ccg: Add extern "C". * gio/src/settings.ccg: Add extern "C". * gio/src/socketcontrolmessage.[ccg|hg]: Call SocketControlMessage_Class::deserialize_async_vfunc_callback() via a local function with C linkage. Code that mixes up C linkage and C++ linkage has undefined behavior. Most compilers make no difference between C and C++ linkage, so it has not been an issue so far. Part of issue #1
Diffstat (limited to 'gio/src/settings.ccg')
-rw-r--r--gio/src/settings.ccg12
1 files changed, 8 insertions, 4 deletions
diff --git a/gio/src/settings.ccg b/gio/src/settings.ccg
index 7343bb64..1651c0d5 100644
--- a/gio/src/settings.ccg
+++ b/gio/src/settings.ccg
@@ -33,7 +33,11 @@ struct SettingsMapSlots
Gio::Settings::SlotSetMapping from_property_to_setting;
};
-gboolean
+extern "C"
+{
+// Shall be static. Non-static functions with C linkage get external linkage,
+// even if they are defined in an anonymous namespace.
+static gboolean
Settings_get_mapping_callback(
GValue* to_value, GVariant* from_variant, gpointer user_data)
{
@@ -52,7 +56,7 @@ Settings_get_mapping_callback(
return result;
}
-GVariant*
+static GVariant*
Settings_set_mapping_callback(
const GValue* from_value, const GVariantType* expected_type, gpointer user_data)
{
@@ -71,12 +75,12 @@ Settings_set_mapping_callback(
return result;
}
-void
+static void
Settings_map_callback_destroy(gpointer user_data)
{
delete static_cast<SettingsMapSlots*>(user_data);
}
-
+} // extern "C"
} // anonymous namespace
namespace Gio