[PATCH] make sure all headers are independent

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

 



Make sure is possible to include any headers alone.

I used this script to check independence (run under server directory):
----
#!/bin/bash

set -e

# check not already modified
if grep -q libheaders.la Makefile.am; then
    echo "Header library already prepared" >&2
    exit 1
fi

add_lib() {
    local hdr="$1"

    hdr=${hdr%.h}
    c="mao_${hdr}.c"
    echo "#include \"${hdr}.h\"" > $c
    echo -e "\t$c \\" >&3
}

# add library to compile all headers alones
exec 3>> Makefile.am
echo "
noinst_LTLIBRARIES += libheaders.la
libheaders_la_SOURCES =				\\" >&3
for hdr in *.h; do
    case $hdr in
    spice-bitmap-utils.h)
        add_lib $hdr
        ;;
    spice*.h)
        ;;
    *)
        add_lib $hdr
        ;;
    esac
done
echo -e "\t\$(NULL)" >&3
exec 3>&-
----

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 server/agent-msg-filter.h   | 3 +++
 server/demarshallers.h      | 3 +++
 server/glz-encoder-priv.h   | 5 ++++-
 server/inputs-channel.h     | 2 ++
 server/migration-protocol.h | 1 +
 server/reds-private.h       | 5 +++++
 server/smartcard.h          | 2 ++
 server/sound.h              | 6 ++++--
 server/stat.h               | 2 ++
 server/video-encoder.h      | 3 +++
 server/zlib-encoder.h       | 2 ++
 11 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/server/agent-msg-filter.h b/server/agent-msg-filter.h
index 836ddbd..1835ef9 100644
--- a/server/agent-msg-filter.h
+++ b/server/agent-msg-filter.h
@@ -21,6 +21,9 @@
 #ifndef _H_AGENT_MSG_FILTER
 #define _H_AGENT_MSG_FILTER
 
+#include <inttypes.h>
+#include <glib.h>
+
 /* Possible return values for agent_msg_filter_process_data */
 enum {
     AGENT_MSG_FILTER_OK,
diff --git a/server/demarshallers.h b/server/demarshallers.h
index c3d770d..dc35645 100644
--- a/server/demarshallers.h
+++ b/server/demarshallers.h
@@ -17,6 +17,9 @@
 #ifndef _H_DEMARSHAL
 #define _H_DEMARSHAL
 
+#include <stddef.h>
+#include <inttypes.h>
+
 typedef void (*message_destructor_t)(uint8_t *message);
 typedef uint8_t * (*spice_parse_channel_func_t)(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor,
                                                 size_t *size_out, message_destructor_t *free_message);
diff --git a/server/glz-encoder-priv.h b/server/glz-encoder-priv.h
index 919c439..a4609d9 100644
--- a/server/glz-encoder-priv.h
+++ b/server/glz-encoder-priv.h
@@ -18,7 +18,10 @@
 #ifndef GLZ_ENCODER_PRIV_H_
 #define GLZ_ENCODER_PRIV_H_
 
-#include "red-common.h"
+#include <pthread.h>
+#include <common/lz_common.h>
+
+#include "glz-encoder-dict.h"
 
 /* Interface for using the dictionary for encoding.
    Data structures are exposed for the encoder for efficiency
diff --git a/server/inputs-channel.h b/server/inputs-channel.h
index fce757f..9213aec 100644
--- a/server/inputs-channel.h
+++ b/server/inputs-channel.h
@@ -24,6 +24,8 @@
 #include <stdint.h>
 #include <spice/vd_agent.h>
 
+#include "red-channel.h"
+
 typedef struct InputsChannel InputsChannel;
 
 InputsChannel* inputs_channel_new(RedsState *reds);
diff --git a/server/migration-protocol.h b/server/migration-protocol.h
index 16eafbe..3f08150 100644
--- a/server/migration-protocol.h
+++ b/server/migration-protocol.h
@@ -20,6 +20,7 @@
 
 #include <spice/macros.h>
 #include <spice/vd_agent.h>
+#include <common/log.h>
 
 #include "glz-encoder-dict.h"
 
diff --git a/server/reds-private.h b/server/reds-private.h
index 74a251b..b2f00b6 100644
--- a/server/reds-private.h
+++ b/server/reds-private.h
@@ -19,6 +19,11 @@
 #define REDS_PRIVATE_H
 
 #include <spice/protocol.h>
+#include <spice/stats.h>
+
+#include "main-dispatcher.h"
+#include "main-channel.h"
+#include "inputs-channel.h"
 
 #define MIGRATE_TIMEOUT (MSEC_PER_SEC * 10)
 #define MM_TIME_DELTA 400 /*ms*/
diff --git a/server/smartcard.h b/server/smartcard.h
index 6bda594..2d1356e 100644
--- a/server/smartcard.h
+++ b/server/smartcard.h
@@ -20,6 +20,8 @@
 
 #include <glib-object.h>
 
+#include "char-device.h"
+
 #define RED_TYPE_CHAR_DEVICE_SMARTCARD red_char_device_smartcard_get_type()
 
 #define RED_CHAR_DEVICE_SMARTCARD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), RED_TYPE_CHAR_DEVICE_SMARTCARD, RedCharDeviceSmartcard))
diff --git a/server/sound.h b/server/sound.h
index 25e59f0..76174cf 100644
--- a/server/sound.h
+++ b/server/sound.h
@@ -18,7 +18,9 @@
 #ifndef SOUND_H_
 #define SOUND_H_
 
-#include "spice.h"
+#include "red-common.h"
+
+struct RedClient;
 
 void snd_attach_playback(RedsState *reds, SpicePlaybackInstance *sin);
 void snd_detach_playback(SpicePlaybackInstance *sin);
@@ -28,6 +30,6 @@ void snd_detach_record(SpiceRecordInstance *sin);
 
 void snd_set_playback_compression(int on);
 
-void snd_set_playback_latency(RedClient *client, uint32_t latency);
+void snd_set_playback_latency(struct RedClient *client, uint32_t latency);
 
 #endif
diff --git a/server/stat.h b/server/stat.h
index 7db27ee..f6f7a04 100644
--- a/server/stat.h
+++ b/server/stat.h
@@ -21,6 +21,8 @@
 #include <stdint.h>
 #include <glib.h>
 
+#include "spice.h"
+
 typedef uint32_t StatNodeRef;
 #define INVALID_STAT_REF (~(StatNodeRef)0)
 
diff --git a/server/video-encoder.h b/server/video-encoder.h
index 9833e13..8aa7783 100644
--- a/server/video-encoder.h
+++ b/server/video-encoder.h
@@ -21,6 +21,9 @@
 #ifndef _H_VIDEO_ENCODER
 #define _H_VIDEO_ENCODER
 
+#include <inttypes.h>
+#include <common/draw.h>
+
 enum {
     VIDEO_ENCODER_FRAME_UNSUPPORTED = -1,
     VIDEO_ENCODER_FRAME_DROP,
diff --git a/server/zlib-encoder.h b/server/zlib-encoder.h
index 0620fc7..2800102 100644
--- a/server/zlib-encoder.h
+++ b/server/zlib-encoder.h
@@ -30,6 +30,8 @@
 #ifndef _H_ZLIB_ENCODER
 #define _H_ZLIB_ENCODER
 
+#include <inttypes.h>
+
 typedef struct ZlibEncoder ZlibEncoder;
 typedef struct ZlibEncoderUsrContext ZlibEncoderUsrContext;
 
-- 
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]