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.
This commit is contained in:
Thomas Haller
2024-01-29 16:05:29 +01:00
parent 494f8d4d87
commit 0adb1c24d7
2 changed files with 3 additions and 3 deletions

View File

@@ -36,10 +36,10 @@
* Do not call this function; it is used to share private * Do not call this function; it is used to share private
* API between glib, gobject, and gio. * API between glib, gobject, and gio.
*/ */
GLibPrivateVTable * const GLibPrivateVTable *
glib__private__ (void) glib__private__ (void)
{ {
static GLibPrivateVTable table = { static const GLibPrivateVTable table = {
g_wakeup_new, g_wakeup_new,
g_wakeup_free, g_wakeup_free,
g_wakeup_get_pollfd, g_wakeup_get_pollfd,

View File

@@ -295,7 +295,7 @@ typedef struct {
} GLibPrivateVTable; } GLibPrivateVTable;
GLIB_AVAILABLE_IN_ALL GLIB_AVAILABLE_IN_ALL
GLibPrivateVTable *glib__private__ (void); const GLibPrivateVTable *glib__private__ (void);
/* Please see following for the use of ".ACP" over "" /* Please see following for the use of ".ACP" over ""
* on Windows, although both are accepted at compile-time * on Windows, although both are accepted at compile-time