[Spice-devel] [PATCH v2] Constify spice_server_char_device_recognized_subtypes

Frediano Ziglio fziglio at redhat.com
Fri Jun 24 06:41:26 UTC 2016


Users should not change the list of supported subtypes.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 configure.ac        | 1 +
 server/reds.c       | 4 ++--
 server/spice-char.h | 1 +
 3 files changed, 4 insertions(+), 2 deletions(-)

Changes from v1:
- do not break API;
- add some comments on API breakage updates.

diff --git a/configure.ac b/configure.ac
index 375d26e..4923b40 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11,6 +11,7 @@ AC_PREREQ([2.57])
 # - If any interfaces have been removed or changed since the last public release,
 #   then set age to 0.
 #
+dnl TODO see server/spice-char.h TODO comment for API breakage
 m4_define([SPICE_CURRENT], [12])
 m4_define([SPICE_REVISION], [0])
 m4_define([SPICE_AGE], [11])
diff --git a/server/reds.c b/server/reds.c
index fdf62e5..56138e1 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3161,7 +3161,7 @@ SPICE_GNUC_VISIBLE void spice_server_char_device_wakeup(SpiceCharDeviceInstance*
 #define SUBTYPE_USBREDIR "usbredir"
 #define SUBTYPE_PORT "port"
 
-static const char *spice_server_char_device_recognized_subtypes_list[] = {
+static const char *const spice_server_char_device_recognized_subtypes_list[] = {
     SUBTYPE_VDAGENT,
 #ifdef USE_SMARTCARD
     SUBTYPE_SMARTCARD,
@@ -3172,7 +3172,7 @@ static const char *spice_server_char_device_recognized_subtypes_list[] = {
 
 SPICE_GNUC_VISIBLE const char** spice_server_char_device_recognized_subtypes(void)
 {
-    return spice_server_char_device_recognized_subtypes_list;
+    return (const char **) spice_server_char_device_recognized_subtypes_list;
 }
 
 static void reds_add_char_device(RedsState *reds, RedCharDevice *dev)
diff --git a/server/spice-char.h b/server/spice-char.h
index efd685d..1a8a031 100644
--- a/server/spice-char.h
+++ b/server/spice-char.h
@@ -56,6 +56,7 @@ struct SpiceCharDeviceInstance {
 
 void spice_server_char_device_wakeup(SpiceCharDeviceInstance *sin);
 void spice_server_port_event(SpiceCharDeviceInstance *char_device, uint8_t event);
+/* TODO change return to const char *const * when API break */
 const char** spice_server_char_device_recognized_subtypes(void);
 
 #endif /* SPICE_CHAR_H_ */
-- 
2.7.4



More information about the Spice-devel mailing list