[Spice-devel] [PATCH spice-server] Remove g_smartcard_channel global
Frediano Ziglio
fziglio at redhat.com
Wed Oct 26 09:29:42 UTC 2016
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
server/reds.c | 2 +-
server/reds.h | 1 +
server/smartcard.c | 7 ++-----
3 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/server/reds.c b/server/reds.c
index 45d23d4..19ca568 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -464,7 +464,7 @@ void reds_unregister_channel(RedsState *reds, RedChannel *channel)
}
}
-static RedChannel *reds_find_channel(RedsState *reds, uint32_t type, uint32_t id)
+RedChannel *reds_find_channel(RedsState *reds, uint32_t type, uint32_t id)
{
GListIter it;
RedChannel *channel;
diff --git a/server/reds.h b/server/reds.h
index cd62fc1..28e3444 100644
--- a/server/reds.h
+++ b/server/reds.h
@@ -47,6 +47,7 @@ void reds_enable_mm_time(RedsState *reds);
uint32_t reds_get_mm_time(void);
void reds_register_channel(RedsState *reds, RedChannel *channel);
void reds_unregister_channel(RedsState *reds, RedChannel *channel);
+RedChannel *reds_find_channel(RedsState *reds, uint32_t type, uint32_t id);
int reds_get_mouse_mode(RedsState *reds); // used by inputs_channel
gboolean reds_config_get_agent_mouse(const RedsState *reds); // used by inputs_channel
int reds_has_vdagent(RedsState *reds); // used by inputs channel
diff --git a/server/smartcard.c b/server/smartcard.c
index 655eaf7..53919c0 100644
--- a/server/smartcard.c
+++ b/server/smartcard.c
@@ -602,14 +602,11 @@ red_smartcard_channel_class_init(RedSmartcardChannelClass *klass)
}
-/* FIXME: remove global */
-RedSmartcardChannel *g_smartcard_channel;
-
static void smartcard_init(RedsState *reds)
{
- spice_assert(!g_smartcard_channel);
+ spice_assert(!reds_find_channel(reds, SPICE_CHANNEL_SMARTCARD, 0));
- g_smartcard_channel = red_smartcard_channel_new(reds);
+ red_smartcard_channel_new(reds);
}
--
2.7.4
More information about the Spice-devel
mailing list