From dec3e6a0b91cef38ca3e9780f9ef039c3f7302da Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 21 Feb 2012 13:59:05 +0000 Subject: [PATCH] Avoid forward-declaring Call classes Having more than one typedef for the same name is an error. If forward declarations are needed to break cycles, the typedef must be *moved* (not copied) from the header it'd normally appear in to the header with the forward declaration: for instance, TpCallContent (forward-declared in call-channel.h) gets this right. In extreme cases, a global "types.h" header can forward-declare everything, although that often leads to unnecessary compilation, so we've avoided it in telepathy-glib. --- telepathy-glib/base-call-channel.h | 2 +- telepathy-glib/base-call-content.h | 3 --- telepathy-glib/base-call-internal.h | 18 ++++++++---------- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/telepathy-glib/base-call-channel.h b/telepathy-glib/base-call-channel.h index 7f054c2..01f6c7a 100644 --- a/telepathy-glib/base-call-channel.h +++ b/telepathy-glib/base-call-channel.h @@ -24,10 +24,10 @@ #include #include +#include G_BEGIN_DECLS -typedef struct _TpBaseCallChannel TpBaseCallChannel; typedef struct _TpBaseCallChannelPrivate TpBaseCallChannelPrivate; typedef struct _TpBaseCallChannelClass TpBaseCallChannelClass; diff --git a/telepathy-glib/base-call-content.h b/telepathy-glib/base-call-content.h index 56245f0..ea15e08 100644 --- a/telepathy-glib/base-call-content.h +++ b/telepathy-glib/base-call-content.h @@ -31,9 +31,6 @@ G_BEGIN_DECLS -/* forward declaration */ -typedef struct _TpBaseCallChannel TpBaseCallChannel; - typedef struct _TpBaseCallContent TpBaseCallContent; typedef struct _TpBaseCallContentPrivate TpBaseCallContentPrivate; typedef struct _TpBaseCallContentClass TpBaseCallContentClass; diff --git a/telepathy-glib/base-call-internal.h b/telepathy-glib/base-call-internal.h index aae5e17..9e40547 100644 --- a/telepathy-glib/base-call-internal.h +++ b/telepathy-glib/base-call-internal.h @@ -22,20 +22,18 @@ #ifndef __TP_BASE_CALL_INTERNAL_H__ #define __TP_BASE_CALL_INTERNAL_H__ +#include +#include +#include #include +#include +#include +#include +#include +#include G_BEGIN_DECLS -/* Forward declaration */ -typedef struct _TpBaseCallChannel TpBaseCallChannel; -typedef struct _TpBaseCallContent TpBaseCallContent; -typedef struct _TpBaseCallStream TpBaseCallStream; -typedef struct _TpCallContentMediaDescription TpCallContentMediaDescription; -typedef struct _TpBaseMediaCallChannel TpBaseMediaCallChannel; -typedef struct _TpBaseMediaCallContent TpBaseMediaCallContent; -typedef struct _TpBaseMediaCallStream TpBaseMediaCallStream; -typedef struct _TpCallStreamEndpoint TpCallStreamEndpoint; - /* Implemented in base-call-content.c */ void _tp_base_call_content_set_channel (TpBaseCallContent *self, TpBaseCallChannel *channel); -- 1.7.9