From 0adb1c24d706babd0fa73d0c17fedc633be0f5e0 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 29 Jan 2024 16:05:29 +0100 Subject: [PATCH] glib: return const pointer from glib__private__() also, make the global variable "static const". That may allow the linker to place the variable into read-only memory, so we are a bit more confident that it cannot be modified. --- glib/glib-private.c | 4 ++-- glib/glib-private.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/glib/glib-private.c b/glib/glib-private.c index c2b68a060..836867717 100644 --- a/glib/glib-private.c +++ b/glib/glib-private.c @@ -36,10 +36,10 @@ * Do not call this function; it is used to share private * API between glib, gobject, and gio. */ -GLibPrivateVTable * +const GLibPrivateVTable * glib__private__ (void) { - static GLibPrivateVTable table = { + static const GLibPrivateVTable table = { g_wakeup_new, g_wakeup_free, g_wakeup_get_pollfd, diff --git a/glib/glib-private.h b/glib/glib-private.h index 479ebb9df..bc60c3472 100644 --- a/glib/glib-private.h +++ b/glib/glib-private.h @@ -295,7 +295,7 @@ typedef struct { } GLibPrivateVTable; GLIB_AVAILABLE_IN_ALL -GLibPrivateVTable *glib__private__ (void); +const GLibPrivateVTable *glib__private__ (void); /* Please see following for the use of ".ACP" over "" * on Windows, although both are accepted at compile-time