[spice-server] Remove duplicate typedef

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

 



This fixes compilation on el6. This is achieved by moving the most problematic
typedef to a red-types.h header. Ideally, it will go away once we have put some
order in the header content/API/... For example, StreamAgent would be better as
an opaque type.
---

Here is my take on this.

Christophe

 server/Makefile.am           |  1 +
 server/image-cache.h         |  4 +---
 server/main-channel-client.h |  7 ++-----
 server/main-channel.c        |  1 +
 server/main-channel.h        |  2 +-
 server/red-channel.h         |  2 +-
 server/red-types.h           | 26 ++++++++++++++++++++++++++
 server/red-worker.c          |  2 +-
 server/reds.c                |  1 +
 server/sound.c               |  1 +
 server/stream.c              |  3 ++-
 server/stream.h              |  3 ---
 12 files changed, 38 insertions(+), 15 deletions(-)
 create mode 100644 server/red-types.h

diff --git a/server/Makefile.am b/server/Makefile.am
index cca3b9b..708940d 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -148,6 +148,7 @@ libserver_la_SOURCES =				\
 	display-limits.h			\
 	dcc-encoders.c					\
 	dcc-encoders.h					\
+	red-types.h				\
 	$(NULL)
 
 if HAVE_SMARTCARD
diff --git a/server/image-cache.h b/server/image-cache.h
index 38a318e..fffd82d 100644
--- a/server/image-cache.h
+++ b/server/image-cache.h
@@ -23,9 +23,7 @@
 #include <common/canvas_base.h>
 #include <common/ring.h>
 
-/* FIXME: move back to display-channel.h (once structs are private) */
-typedef struct Drawable Drawable;
-typedef struct DisplayChannelClient DisplayChannelClient;
+#include "red-types.h"
 
 typedef struct ImageCacheItem {
     RingItem lru_link;
diff --git a/server/main-channel-client.h b/server/main-channel-client.h
index c74f847..6ce3f34 100644
--- a/server/main-channel-client.h
+++ b/server/main-channel-client.h
@@ -17,11 +17,8 @@
 #ifndef __MAIN_CHANNEL_CLIENT_H__
 #define __MAIN_CHANNEL_CLIENT_H__
 
-#include "red-channel.h"
-
-/* FIXME: remove extra MainChannel typedef when possible */
-typedef struct MainChannel MainChannel;
-typedef struct MainChannelClient MainChannelClient;
+#include "main-channel.h"
+#include "red-types.h"
 
 MainChannelClient *main_channel_client_create(MainChannel *main_chan, RedClient *client,
                                               RedsStream *stream, uint32_t connection_id,
diff --git a/server/main-channel.c b/server/main-channel.c
index 1a18200..daa6b5d 100644
--- a/server/main-channel.c
+++ b/server/main-channel.c
@@ -23,6 +23,7 @@
 
 #include "red-common.h"
 #include "main-channel.h"
+#include "main-channel-client.h"
 #include "reds.h"
 
 int main_channel_is_connected(MainChannel *main_chan)
diff --git a/server/main-channel.h b/server/main-channel.h
index 868a14a..d4b63f6 100644
--- a/server/main-channel.h
+++ b/server/main-channel.h
@@ -23,7 +23,7 @@
 #include <common/marshaller.h>
 
 #include "red-channel.h"
-#include "main-channel-client.h"
+#include "red-types.h"
 
 // TODO: Defines used to calculate receive buffer size, and also by reds.c
 // other options: is to make a reds_main_consts.h, to duplicate defines.
diff --git a/server/red-channel.h b/server/red-channel.h
index 57ea660..c71927a 100644
--- a/server/red-channel.h
+++ b/server/red-channel.h
@@ -33,6 +33,7 @@
 #include "reds-stream.h"
 #include "stat.h"
 #include "red-pipe-item.h"
+#include "red-types.h"
 
 #define MAX_SEND_BUFS 1000
 #define CLIENT_ACK_WINDOW 20
@@ -131,7 +132,6 @@ typedef struct OutgoingHandler {
 typedef struct RedChannel RedChannel;
 typedef struct RedChannelClient RedChannelClient;
 typedef struct RedClient RedClient;
-typedef struct MainChannelClient MainChannelClient;
 
 /* Messages handled by red_channel
  * SET_ACK - sent to client on channel connection
diff --git a/server/red-types.h b/server/red-types.h
new file mode 100644
index 0000000..a920074
--- /dev/null
+++ b/server/red-types.h
@@ -0,0 +1,26 @@
+/*
+    Copyright (C) 2016 Red Hat, Inc.
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _H_RED_TYPES
+#define _H_RED_TYPES
+
+typedef struct MainChannelClient MainChannelClient;
+typedef struct DisplayChannelClient DisplayChannelClient;
+typedef struct DisplayChannel DisplayChannel;
+typedef struct Drawable Drawable;
+
+#endif
diff --git a/server/red-worker.c b/server/red-worker.c
index 0c945c1..63c0d00 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -45,8 +45,8 @@
 #include <common/ring.h>
 
 #include "display-channel.h"
+#include "main-channel-client.h"
 #include "stream.h"
-
 #include "spice.h"
 #include "red-worker.h"
 #include "cursor-channel.h"
diff --git a/server/reds.c b/server/reds.c
index 5c0f9b6..ff51598 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -57,6 +57,7 @@
 #include "agent-msg-filter.h"
 #include "inputs-channel.h"
 #include "main-channel.h"
+#include "main-channel-client.h"
 #include "red-qxl.h"
 #include "main-dispatcher.h"
 #include "sound.h"
diff --git a/server/sound.c b/server/sound.c
index 8335101..3e6eec4 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -32,6 +32,7 @@
 #include "spice.h"
 #include "red-common.h"
 #include "main-channel.h"
+#include "main-channel-client.h"
 #include "reds.h"
 #include "red-qxl.h"
 #include "sound.h"
diff --git a/server/stream.c b/server/stream.c
index 2aa13d1..3cf50ed 100644
--- a/server/stream.c
+++ b/server/stream.c
@@ -18,8 +18,9 @@
 #include <config.h>
 #endif
 
-#include "stream.h"
 #include "display-channel.h"
+#include "main-channel-client.h"
+#include "stream.h"
 
 #define FPS_TEST_INTERVAL 1
 #define FOREACH_STREAMS(display, item)                  \
diff --git a/server/stream.h b/server/stream.h
index 715f920..80dc60f 100644
--- a/server/stream.h
+++ b/server/stream.h
@@ -42,9 +42,6 @@
 #define RED_STREAM_DEFAULT_LOW_START_BIT_RATE (2.5 * 1024 * 1024) // 2.5Mbps
 #define MAX_FPS 30
 
-/* move back to display_channel once struct private */
-typedef struct DisplayChannel DisplayChannel;
-
 typedef struct Stream Stream;
 
 typedef struct RedStreamActivateReportItem {
-- 
2.7.4

_______________________________________________
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]