SDL: Re-add the simpler SDL_DBus_AppendDictWithKeyValue() function

From 6b12fbc6b7eca01707dd04c216876e5857d66acf Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 23 Jun 2023 07:28:05 -0700
Subject: [PATCH] Re-add the simpler SDL_DBus_AppendDictWithKeyValue() function

---
 src/core/linux/SDL_dbus.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/src/core/linux/SDL_dbus.c b/src/core/linux/SDL_dbus.c
index 6546f9ea5938..11092c011d95 100644
--- a/src/core/linux/SDL_dbus.c
+++ b/src/core/linux/SDL_dbus.c
@@ -367,7 +367,7 @@ void SDL_DBus_ScreensaverTickle(void)
     }
 }
 
-static SDL_bool SDL_DBus_AppendDictWithKeysValues(DBusMessageIter *iterInit, const char **keys, const char **values, int count)
+static SDL_bool SDL_DBus_AppendDictWithKeysAndValues(DBusMessageIter *iterInit, const char **keys, const char **values, int count)
 {
     DBusMessageIter iterDict;
 
@@ -414,6 +414,16 @@ static SDL_bool SDL_DBus_AppendDictWithKeysValues(DBusMessageIter *iterInit, con
     return SDL_FALSE;
 }
 
+static SDL_bool SDL_DBus_AppendDictWithKeyValue(DBusMessageIter *iterInit, const char *key, const char *value)
+{
+   const char *keys[1];
+   const char *values[1];
+
+   keys[0] = key;
+   values[0] = value;
+   return SDL_DBus_AppendDictWithKeysAndValues(iterInit, keys, values, 1);
+}
+
 SDL_bool SDL_DBus_ScreensaverInhibit(SDL_bool inhibit)
 {
     const char *default_inhibit_reason = "Playing a game";
@@ -459,15 +469,9 @@ SDL_bool SDL_DBus_ScreensaverInhibit(SDL_bool inhibit)
             dbus.message_iter_init_append(msg, &iterInit);
 
             /* a{sv} */
-            {
-               const char *keys[1];
-               const char *values[1];
-               keys[0] = key;
-               values[0] = reason;
-               if (!SDL_DBus_AppendDictWithKeysValues(&iterInit, keys, values, 1)) {
-                   dbus.message_unref(msg);
-                   return SDL_FALSE;
-               }
+            if (!SDL_DBus_AppendDictWithKeyValue(&iterInit, key, reason)) {
+                dbus.message_unref(msg);
+                return SDL_FALSE;
             }
 
             if (SDL_DBus_CallWithBasicReply(dbus.session_conn, msg, DBUS_TYPE_OBJECT_PATH, &reply)) {