[PATCH] xfree86: Move definition of xf86OptionPtr into separate header file
Peter Hutterer
peter.hutterer at who-t.net
Mon Sep 26 17:57:05 PDT 2011
The pile of spaghettis that is the xfree86 include dependencies make it
rather hard to have a single typedef somewhere that's not interfering with
everything else or drags in a whole bunch of other includes.
Move the xf86OptionRec and GenericListRec declarations into a separate
header.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
I found compiler errors on RHEL yesterday because of this patch:
http://lists.freedesktop.org/archives/xorg-devel/2011-August/024353.html
it introduces a few duplicate typedefs that gcc 4.6 will cope with without
warnings but cause compiler errors. Given that the xfree86 includes are
a bit hard to handle, this was the simplest way of fixing them. I'll squash
this in with the above patch before requesting the pull on it.
hw/xfree86/common/Makefile.am | 2 +-
hw/xfree86/common/xf86Opt.h | 3 +-
hw/xfree86/common/xf86Optionstr.h | 53 +++++++++++++++++++++++++++++++++++
hw/xfree86/os-support/xf86_OSproc.h | 3 +-
hw/xfree86/parser/Makefile.am | 2 +
hw/xfree86/parser/xf86Optrec.h | 26 +----------------
6 files changed, 59 insertions(+), 30 deletions(-)
create mode 100644 hw/xfree86/common/xf86Optionstr.h
diff --git a/hw/xfree86/common/Makefile.am b/hw/xfree86/common/Makefile.am
index c031d4b..23ddb5c 100644
--- a/hw/xfree86/common/Makefile.am
+++ b/hw/xfree86/common/Makefile.am
@@ -51,7 +51,7 @@ sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \
xf86PciInfo.h xf86Priv.h xf86Privstr.h \
xf86cmap.h xf86fbman.h xf86str.h xf86Xinput.h xisb.h \
$(XVSDKINCS) $(XF86VMODE_SDK) xorgVersion.h \
- xf86sbusBus.h xf86VGAarbiter.h
+ xf86sbusBus.h xf86VGAarbiter.h xf86Optionstr.h
DISTCLEANFILES = xf86Build.h
CLEANFILES = $(BUILT_SOURCES)
diff --git a/hw/xfree86/common/xf86Opt.h b/hw/xfree86/common/xf86Opt.h
index 68ce166..88392dc 100644
--- a/hw/xfree86/common/xf86Opt.h
+++ b/hw/xfree86/common/xf86Opt.h
@@ -30,6 +30,7 @@
#ifndef _XF86_OPT_H_
#define _XF86_OPT_H_
+#include "xf86Optionstr.h"
typedef struct {
double freq;
@@ -69,8 +70,6 @@ typedef struct {
Bool found;
} OptionInfoRec, *OptionInfoPtr;
-typedef struct _XF86OptionRec *XF86OptionPtr;
-
extern _X_EXPORT int xf86SetIntOption(XF86OptionPtr optlist, const char *name, int deflt);
extern _X_EXPORT double xf86SetRealOption(XF86OptionPtr optlist, const char *name, double deflt);
extern _X_EXPORT char *xf86SetStrOption(XF86OptionPtr optlist, const char *name, char *deflt);
diff --git a/hw/xfree86/common/xf86Optionstr.h b/hw/xfree86/common/xf86Optionstr.h
new file mode 100644
index 0000000..8cc82d3
--- /dev/null
+++ b/hw/xfree86/common/xf86Optionstr.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright © 2011 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifndef XF86OPTIONSTR_H
+#define XF86OPTIONSTR_H
+
+/*
+ * all records that need to be linked lists should contain a GenericList as
+ * their first field.
+ */
+typedef struct generic_list_rec
+{
+ void *next;
+}
+GenericListRec, *GenericListPtr, *glp;
+
+/*
+ * All options are stored using this data type.
+ */
+typedef struct _XF86OptionRec
+{
+ GenericListRec list;
+ char *opt_name;
+ char *opt_val;
+ int opt_used;
+ char *opt_comment;
+}
+XF86OptionRec;
+
+typedef struct _XF86OptionRec *XF86OptionPtr;
+
+#endif
diff --git a/hw/xfree86/os-support/xf86_OSproc.h b/hw/xfree86/os-support/xf86_OSproc.h
index fb64a34..6a29fbd 100644
--- a/hw/xfree86/os-support/xf86_OSproc.h
+++ b/hw/xfree86/os-support/xf86_OSproc.h
@@ -126,11 +126,10 @@
#include <X11/Xfuncproto.h>
#include "opaque.h"
+#include "xf86Optionstr.h"
_XFUNCPROTOBEGIN
-typedef struct _XF86OptionRec *XF86OptionPtr;
-
/* public functions */
extern _X_EXPORT Bool xf86LinearVidMem(void);
extern _X_EXPORT Bool xf86CheckMTRR(int);
diff --git a/hw/xfree86/parser/Makefile.am b/hw/xfree86/parser/Makefile.am
index 1cd70e7..002cfbf 100644
--- a/hw/xfree86/parser/Makefile.am
+++ b/hw/xfree86/parser/Makefile.am
@@ -50,3 +50,5 @@ EXTRA_DIST = \
sdk_HEADERS = \
xf86Parser.h \
xf86Optrec.h
+
+INCLUDES = -I$(srcdir)/../common
diff --git a/hw/xfree86/parser/xf86Optrec.h b/hw/xfree86/parser/xf86Optrec.h
index 70bd744..61a8c5f 100644
--- a/hw/xfree86/parser/xf86Optrec.h
+++ b/hw/xfree86/parser/xf86Optrec.h
@@ -65,34 +65,10 @@
#define _xf86Optrec_h_
#include <stdio.h>
#include <string.h>
+#include "xf86Optionstr.h"
#include <X11/Xfuncproto.h>
-/*
- * all records that need to be linked lists should contain a GenericList as
- * their first field.
- */
-typedef struct generic_list_rec
-{
- void *next;
-}
-GenericListRec, *GenericListPtr, *glp;
-
-/*
- * All options are stored using this data type.
- */
-typedef struct _XF86OptionRec
-{
- GenericListRec list;
- char *opt_name;
- char *opt_val;
- int opt_used;
- char *opt_comment;
-}
-XF86OptionRec;
-
-typedef struct _XF86OptionRec *XF86OptionPtr;
-
extern _X_EXPORT XF86OptionPtr xf86addNewOption(XF86OptionPtr head, char *name, char *val);
extern _X_EXPORT XF86OptionPtr xf86optionListDup(XF86OptionPtr opt);
extern _X_EXPORT void xf86optionListFree(XF86OptionPtr opt);
--
1.7.6
More information about the xorg-devel
mailing list