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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3386>
This commit is contained in:
Florian Müllner 2023-11-10 20:48:19 +01:00 committed by Marge Bot
parent 03235773be
commit dc8de3bfd5
2 changed files with 3 additions and 3 deletions

View File

@ -176,9 +176,9 @@ clutter_keys_keyval_compare (const void *pkey, const void *pbase)
* clutter_keyval_name: * clutter_keyval_name:
* @keyval: A key value. * @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) clutter_keyval_name (unsigned int keyval)
{ {
static char buf[100]; static char buf[100];

View File

@ -35,6 +35,6 @@ void clutter_keyval_convert_case (unsigned int symbol,
unsigned int *upper); unsigned int *upper);
CLUTTER_EXPORT CLUTTER_EXPORT
char * clutter_keyval_name (unsigned int keyval); const char * clutter_keyval_name (unsigned int keyval);
G_END_DECLS G_END_DECLS