[PATCH 1/3] constify some global variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 server/main-channel.c       |  2 +-
 server/red-channel.c        | 32 ++++++++++++++++----------------
 server/reds.c               |  4 ++--
 server/spice-bitmap-utils.c |  2 +-
 4 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/server/main-channel.c b/server/main-channel.c
index 52a0078..9fa066d 100644
--- a/server/main-channel.c
+++ b/server/main-channel.c
@@ -57,7 +57,7 @@
 
 #define CLIENT_CONNECTIVITY_TIMEOUT (MSEC_PER_SEC * 30)
 
-static uint8_t zero_page[ZERO_BUF_SIZE] = {0};
+static const uint8_t zero_page[ZERO_BUF_SIZE] = {0};
 
 enum {
     PIPE_ITEM_TYPE_MAIN_CHANNELS_LIST = PIPE_ITEM_TYPE_CHANNEL_BASE,
diff --git a/server/red-channel.c b/server/red-channel.c
index d7ff37e..3ee6192 100644
--- a/server/red-channel.c
+++ b/server/red-channel.c
@@ -176,21 +176,21 @@ static void mini_header_set_msg_sub_list(SpiceDataHeaderOpaque *header, uint32_t
     spice_error("attempt to set header sub list on mini header");
 }
 
-static SpiceDataHeaderOpaque full_header_wrapper = {NULL, sizeof(SpiceDataHeader),
-                                                    full_header_set_msg_type,
-                                                    full_header_set_msg_size,
-                                                    full_header_set_msg_serial,
-                                                    full_header_set_msg_sub_list,
-                                                    full_header_get_msg_type,
-                                                    full_header_get_msg_size};
-
-static SpiceDataHeaderOpaque mini_header_wrapper = {NULL, sizeof(SpiceMiniDataHeader),
-                                                    mini_header_set_msg_type,
-                                                    mini_header_set_msg_size,
-                                                    mini_header_set_msg_serial,
-                                                    mini_header_set_msg_sub_list,
-                                                    mini_header_get_msg_type,
-                                                    mini_header_get_msg_size};
+static const SpiceDataHeaderOpaque full_header_wrapper = {NULL, sizeof(SpiceDataHeader),
+                                                          full_header_set_msg_type,
+                                                          full_header_set_msg_size,
+                                                          full_header_set_msg_serial,
+                                                          full_header_set_msg_sub_list,
+                                                          full_header_get_msg_type,
+                                                          full_header_get_msg_size};
+
+static const SpiceDataHeaderOpaque mini_header_wrapper = {NULL, sizeof(SpiceMiniDataHeader),
+                                                          mini_header_set_msg_type,
+                                                          mini_header_set_msg_size,
+                                                          mini_header_set_msg_serial,
+                                                          mini_header_set_msg_sub_list,
+                                                          mini_header_get_msg_type,
+                                                          mini_header_get_msg_size};
 
 /* return the number of bytes read. -1 in case of error */
 static int red_peer_receive(RedsStream *stream, uint8_t *buf, uint32_t size)
@@ -1092,7 +1092,7 @@ static void dummy_watch_remove(SpiceWatch *watch)
 }
 
 // TODO: actually, since I also use channel_client_dummy, no need for core. Can be NULL
-SpiceCoreInterfaceInternal dummy_core = {
+static const SpiceCoreInterfaceInternal dummy_core = {
     .watch_update_mask = dummy_watch_update_mask,
     .watch_add = dummy_watch_add,
     .watch_remove = dummy_watch_remove,
diff --git a/server/reds.c b/server/reds.c
index b917f26..444d7ac 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -874,7 +874,7 @@ SPICE_GNUC_VISIBLE int spice_server_get_num_clients(SpiceServer *s)
     return reds_get_n_clients(reds);
 }
 
-static int secondary_channels[] = {
+static const int secondary_channels[] = {
     SPICE_CHANNEL_MAIN, SPICE_CHANNEL_DISPLAY, SPICE_CHANNEL_CURSOR, SPICE_CHANNEL_INPUTS};
 
 static int channel_is_secondary(RedChannel *channel)
@@ -3733,7 +3733,7 @@ SPICE_GNUC_VISIBLE int spice_server_set_zlib_glz_compression(SpiceServer *s, spi
 
 SPICE_GNUC_VISIBLE int spice_server_set_channel_security(SpiceServer *s, const char *channel, int security)
 {
-    static const char *names[] = {
+    static const char *const names[] = {
         [ SPICE_CHANNEL_MAIN     ] = "main",
         [ SPICE_CHANNEL_DISPLAY  ] = "display",
         [ SPICE_CHANNEL_INPUTS   ] = "inputs",
diff --git a/server/spice-bitmap-utils.c b/server/spice-bitmap-utils.c
index 8350e7f..d13d757 100644
--- a/server/spice-bitmap-utils.c
+++ b/server/spice-bitmap-utils.c
@@ -172,7 +172,7 @@ write_err:
 
 static bool dump_line(FILE *f, uint8_t* line, uint16_t n_pixel_bits, int width, int row_size)
 {
-    static char zeroes[4] = { 0 };
+    static const char zeroes[4] = { 0 };
     int copy_bytes_size = SPICE_ALIGN(n_pixel_bits * width, 8) / 8;
 
     WRITE(line, copy_bytes_size, f);
-- 
2.5.0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]