From dc8de3bfd52fd074bc3b86541b3222c996081015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 10 Nov 2023 20:48:19 +0100 Subject: [PATCH] clutter/keyval: Fix keyval_name() transfer annotation clutter_keyval_name() returns a pointer to a static array, not newly allocated memory. Add a transfer annotation to indicate that callers must not free the returned memory. While add it, make the return value const to stress further that callers shouldn't touch the returned memory. Part-of: --- clutter/clutter/clutter-keyval.c | 4 ++-- clutter/clutter/clutter-keyval.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clutter/clutter/clutter-keyval.c b/clutter/clutter/clutter-keyval.c index 59c5d1047..d3bf99843 100644 --- a/clutter/clutter/clutter-keyval.c +++ b/clutter/clutter/clutter-keyval.c @@ -176,9 +176,9 @@ clutter_keys_keyval_compare (const void *pkey, const void *pbase) * clutter_keyval_name: * @keyval: A key value. * - * Returns: (nullable): The corresponding symbolic name. + * Returns: (nullable) (transfer none): The corresponding symbolic name. */ -char * +const char * clutter_keyval_name (unsigned int keyval) { static char buf[100]; diff --git a/clutter/clutter/clutter-keyval.h b/clutter/clutter/clutter-keyval.h index 76f750414..8e6267aa6 100644 --- a/clutter/clutter/clutter-keyval.h +++ b/clutter/clutter/clutter-keyval.h @@ -35,6 +35,6 @@ void clutter_keyval_convert_case (unsigned int symbol, unsigned int *upper); CLUTTER_EXPORT -char * clutter_keyval_name (unsigned int keyval); +const char * clutter_keyval_name (unsigned int keyval); G_END_DECLS