[PATCH] typedefs.h: Move some typedefs to a separate file

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

 



The relationship between sinks, sources, cards, profiles, and ports
is becoming ever more intertwined, to the point that if you try to
include one file from the other, you're likely to end up with some
weird error somewhere else.

Work around this by creating a new typedefs.h, which does not depend
on anything else, and just creates a few typedefs.

(Can be expanded with more typedefs in the future if the need arises.)

Signed-off-by: David Henningsson <david.henningsson at canonical.com>
---
 src/pulsecore/card.h          |  7 +++----
 src/pulsecore/client.h        |  3 +--
 src/pulsecore/core.h          |  3 +--
 src/pulsecore/device-port.h   |  3 +--
 src/pulsecore/sink-input.h    |  3 +--
 src/pulsecore/sink.h          |  4 +---
 src/pulsecore/source-output.h |  3 +--
 src/pulsecore/source.h        |  3 +--
 src/pulsecore/typedefs.h      | 37 +++++++++++++++++++++++++++++++++++++
 9 files changed, 47 insertions(+), 19 deletions(-)
 create mode 100644 src/pulsecore/typedefs.h

diff --git a/src/pulsecore/card.h b/src/pulsecore/card.h
index a72c8c2..30bfc0e 100644
--- a/src/pulsecore/card.h
+++ b/src/pulsecore/card.h
@@ -20,8 +20,7 @@
   along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
 ***/
 
-typedef struct pa_card pa_card;
-
+#include <pulsecore/typedefs.h>
 #include <pulse/proplist.h>
 #include <pulsecore/core.h>
 #include <pulsecore/module.h>
@@ -35,7 +34,7 @@ typedef enum pa_available {
     PA_AVAILABLE_YES = 2,
 } pa_available_t;
 
-typedef struct pa_card_profile {
+struct pa_card_profile {
     pa_card *card;
     char *name;
     char *description;
@@ -59,7 +58,7 @@ typedef struct pa_card_profile {
     unsigned max_source_channels;
 
     /* .. followed by some implementation specific data */
-} pa_card_profile;
+};
 
 #define PA_CARD_PROFILE_DATA(d) ((void*) ((uint8_t*) d + PA_ALIGN(sizeof(pa_card_profile))))
 
diff --git a/src/pulsecore/client.h b/src/pulsecore/client.h
index cd55348..eb8173d 100644
--- a/src/pulsecore/client.h
+++ b/src/pulsecore/client.h
@@ -22,8 +22,7 @@
 
 #include <inttypes.h>
 
-typedef struct pa_client pa_client;
-
+#include <pulsecore/typedefs.h>
 #include <pulse/proplist.h>
 #include <pulsecore/core.h>
 #include <pulsecore/module.h>
diff --git a/src/pulsecore/core.h b/src/pulsecore/core.h
index 6a8affc..aefc1eb 100644
--- a/src/pulsecore/core.h
+++ b/src/pulsecore/core.h
@@ -20,12 +20,11 @@
   along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
 ***/
 
+#include <pulsecore/typedefs.h>
 #include <pulse/mainloop-api.h>
 #include <pulse/sample.h>
 #include <pulsecore/cpu.h>
 
-typedef struct pa_core pa_core;
-
 /* This is a bitmask that encodes the cause why a sink/source is
  * suspended. */
 typedef enum pa_suspend_cause {
diff --git a/src/pulsecore/device-port.h b/src/pulsecore/device-port.h
index e3224fd..85c41fa 100644
--- a/src/pulsecore/device-port.h
+++ b/src/pulsecore/device-port.h
@@ -22,14 +22,13 @@
   along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
 ***/
 
-typedef struct pa_device_port pa_device_port;
-
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
 #include <inttypes.h>
 
+#include <pulsecore/typedefs.h>
 #include <pulse/def.h>
 #include <pulsecore/object.h>
 #include <pulsecore/hashmap.h>
diff --git a/src/pulsecore/sink-input.h b/src/pulsecore/sink-input.h
index 457f018..86deab2 100644
--- a/src/pulsecore/sink-input.h
+++ b/src/pulsecore/sink-input.h
@@ -23,8 +23,7 @@
 
 #include <inttypes.h>
 
-typedef struct pa_sink_input pa_sink_input;
-
+#include <pulsecore/typedefs.h>
 #include <pulse/sample.h>
 #include <pulse/format.h>
 #include <pulsecore/memblockq.h>
diff --git a/src/pulsecore/sink.h b/src/pulsecore/sink.h
index 3ae8240..5df109e 100644
--- a/src/pulsecore/sink.h
+++ b/src/pulsecore/sink.h
@@ -21,11 +21,9 @@
   along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
 ***/
 
-typedef struct pa_sink pa_sink;
-typedef struct pa_sink_volume_change pa_sink_volume_change;
-
 #include <inttypes.h>
 
+#include <pulsecore/typedefs.h>
 #include <pulse/def.h>
 #include <pulse/format.h>
 #include <pulse/sample.h>
diff --git a/src/pulsecore/source-output.h b/src/pulsecore/source-output.h
index 24555e4..26be484 100644
--- a/src/pulsecore/source-output.h
+++ b/src/pulsecore/source-output.h
@@ -22,8 +22,7 @@
 
 #include <inttypes.h>
 
-typedef struct pa_source_output pa_source_output;
-
+#include <pulsecore/typedefs.h>
 #include <pulse/sample.h>
 #include <pulse/format.h>
 #include <pulsecore/memblockq.h>
diff --git a/src/pulsecore/source.h b/src/pulsecore/source.h
index 9ee0783..19fb41b 100644
--- a/src/pulsecore/source.h
+++ b/src/pulsecore/source.h
@@ -21,11 +21,10 @@
   along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
 ***/
 
-typedef struct pa_source pa_source;
-typedef struct pa_source_volume_change pa_source_volume_change;
 
 #include <inttypes.h>
 
+#include <pulsecore/typedefs.h>
 #include <pulse/def.h>
 #include <pulse/format.h>
 #include <pulse/sample.h>
diff --git a/src/pulsecore/typedefs.h b/src/pulsecore/typedefs.h
new file mode 100644
index 0000000..3652f8f
--- /dev/null
+++ b/src/pulsecore/typedefs.h
@@ -0,0 +1,37 @@
+#ifndef footypedefshfoo
+#define footypedefshfoo
+
+/***
+  This file is part of PulseAudio.
+
+  Copyright 2015 Canonical Ltd.
+  Written by David Henningsson <david.henningsson at canonical.com>
+
+  PulseAudio 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.
+
+  PulseAudio 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
+  General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+***/
+
+typedef struct pa_card pa_card;
+typedef struct pa_card_profile pa_card_profile;
+typedef struct pa_client pa_client;
+typedef struct pa_core pa_core;
+typedef struct pa_device_port pa_device_port;
+typedef struct pa_sink pa_sink;
+typedef struct pa_sink_volume_change pa_sink_volume_change;
+typedef struct pa_sink_input pa_sink_input;
+typedef struct pa_source pa_source;
+typedef struct pa_source_volume_change pa_source_volume_change;
+typedef struct pa_source_output pa_source_output;
+
+
+#endif
-- 
1.9.1



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux