[PATCH 3/5] xfree86: switch options from pointer to XF86OptionPtr
Peter Hutterer
peter.hutterer at who-t.net
Wed Aug 10 20:03:12 PDT 2011
In all cases, the pointer was simply type-cast anyway. Let's get some
compile-time type safety going, how about that.
This is technically an API break but if you weren't using an
XF86OptionRec-compatible structure already anyway, things were probably
interesting enough so this won't get your blood pressure up any higher.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
hw/xfree86/common/xf86.h | 2 +-
hw/xfree86/common/xf86Opt.h | 68 +++++++++---------
hw/xfree86/common/xf86Option.c | 111 +++++++++++++++---------------
hw/xfree86/common/xf86Xinput.c | 2 +-
hw/xfree86/common/xf86Xinput.h | 4 +-
hw/xfree86/doc/ddxDesign.xml | 14 ++--
hw/xfree86/os-support/shared/posix_tty.c | 4 +-
hw/xfree86/os-support/xf86_OSproc.h | 6 +-
hw/xfree86/parser/xf86Optrec.h | 2 +-
test/xfree86.c | 11 ++--
10 files changed, 114 insertions(+), 110 deletions(-)
diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index 54332e3..ae152b9 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -332,7 +332,7 @@ extern _X_EXPORT DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePt
/* xf86Option.c */
-extern _X_EXPORT void xf86CollectOptions(ScrnInfoPtr pScrn, pointer extraOpts);
+extern _X_EXPORT void xf86CollectOptions(ScrnInfoPtr pScrn, XF86OptionPtr extraOpts);
/* xf86RandR.c */
diff --git a/hw/xfree86/common/xf86Opt.h b/hw/xfree86/common/xf86Opt.h
index 9453f2a..68ce166 100644
--- a/hw/xfree86/common/xf86Opt.h
+++ b/hw/xfree86/common/xf86Opt.h
@@ -69,34 +69,36 @@ typedef struct {
Bool found;
} OptionInfoRec, *OptionInfoPtr;
-extern _X_EXPORT int xf86SetIntOption(pointer optlist, const char *name, int deflt);
-extern _X_EXPORT double xf86SetRealOption(pointer optlist, const char *name, double deflt);
-extern _X_EXPORT char *xf86SetStrOption(pointer optlist, const char *name, char *deflt);
-extern _X_EXPORT int xf86SetBoolOption(pointer list, const char *name, int deflt );
-extern _X_EXPORT double xf86SetPercentOption(pointer list, const char *name, double deflt );
-extern _X_EXPORT int xf86CheckIntOption(pointer optlist, const char *name, int deflt);
-extern _X_EXPORT double xf86CheckRealOption(pointer optlist, const char *name, double deflt);
-extern _X_EXPORT char *xf86CheckStrOption(pointer optlist, const char *name, char *deflt);
-extern _X_EXPORT int xf86CheckBoolOption(pointer list, const char *name, int deflt );
-extern _X_EXPORT double xf86CheckPercentOption(pointer list, const char *name, double deflt );
-extern _X_EXPORT pointer xf86AddNewOption(pointer head, const char *name, const char *val );
-extern _X_EXPORT pointer xf86NewOption(char *name, char *value );
-extern _X_EXPORT pointer xf86NextOption(pointer list );
-extern _X_EXPORT pointer xf86OptionListCreate(const char **options, int count, int used);
-extern _X_EXPORT pointer xf86OptionListMerge(pointer head, pointer tail);
-extern _X_EXPORT pointer xf86OptionListDuplicate(pointer list);
-extern _X_EXPORT void xf86OptionListFree(pointer opt);
-extern _X_EXPORT char *xf86OptionName(pointer opt);
-extern _X_EXPORT char *xf86OptionValue(pointer opt);
-extern _X_EXPORT void xf86OptionListReport(pointer parm);
-extern _X_EXPORT pointer xf86FindOption(pointer options, const char *name);
-extern _X_EXPORT char *xf86FindOptionValue(pointer options, const char *name);
-extern _X_EXPORT void xf86MarkOptionUsed(pointer option);
-extern _X_EXPORT void xf86MarkOptionUsedByName(pointer options, const char *name);
-extern _X_EXPORT Bool xf86CheckIfOptionUsed(pointer option);
-extern _X_EXPORT Bool xf86CheckIfOptionUsedByName(pointer options, const char *name);
-extern _X_EXPORT void xf86ShowUnusedOptions(int scrnIndex, pointer options);
-extern _X_EXPORT void xf86ProcessOptions(int scrnIndex, pointer options, OptionInfoPtr optinfo);
+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);
+extern _X_EXPORT int xf86SetBoolOption(XF86OptionPtr list, const char *name, int deflt );
+extern _X_EXPORT double xf86SetPercentOption(XF86OptionPtr list, const char *name, double deflt );
+extern _X_EXPORT int xf86CheckIntOption(XF86OptionPtr optlist, const char *name, int deflt);
+extern _X_EXPORT double xf86CheckRealOption(XF86OptionPtr optlist, const char *name, double deflt);
+extern _X_EXPORT char *xf86CheckStrOption(XF86OptionPtr optlist, const char *name, char *deflt);
+extern _X_EXPORT int xf86CheckBoolOption(XF86OptionPtr list, const char *name, int deflt );
+extern _X_EXPORT double xf86CheckPercentOption(XF86OptionPtr list, const char *name, double deflt );
+extern _X_EXPORT XF86OptionPtr xf86AddNewOption(XF86OptionPtr head, const char *name, const char *val );
+extern _X_EXPORT XF86OptionPtr xf86NewOption(char *name, char *value );
+extern _X_EXPORT XF86OptionPtr xf86NextOption(XF86OptionPtr list );
+extern _X_EXPORT XF86OptionPtr xf86OptionListCreate(const char **options, int count, int used);
+extern _X_EXPORT XF86OptionPtr xf86OptionListMerge(XF86OptionPtr head, XF86OptionPtr tail);
+extern _X_EXPORT XF86OptionPtr xf86OptionListDuplicate(XF86OptionPtr list);
+extern _X_EXPORT void xf86OptionListFree(XF86OptionPtr opt);
+extern _X_EXPORT char *xf86OptionName(XF86OptionPtr opt);
+extern _X_EXPORT char *xf86OptionValue(XF86OptionPtr opt);
+extern _X_EXPORT void xf86OptionListReport(XF86OptionPtr parm);
+extern _X_EXPORT XF86OptionPtr xf86FindOption(XF86OptionPtr options, const char *name);
+extern _X_EXPORT char *xf86FindOptionValue(XF86OptionPtr options, const char *name);
+extern _X_EXPORT void xf86MarkOptionUsed(XF86OptionPtr option);
+extern _X_EXPORT void xf86MarkOptionUsedByName(XF86OptionPtr options, const char *name);
+extern _X_EXPORT Bool xf86CheckIfOptionUsed(XF86OptionPtr option);
+extern _X_EXPORT Bool xf86CheckIfOptionUsedByName(XF86OptionPtr options, const char *name);
+extern _X_EXPORT void xf86ShowUnusedOptions(int scrnIndex, XF86OptionPtr options);
+extern _X_EXPORT void xf86ProcessOptions(int scrnIndex, XF86OptionPtr options, OptionInfoPtr optinfo);
extern _X_EXPORT OptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec *table, int token);
extern _X_EXPORT const char *xf86TokenToOptName(const OptionInfoRec *table, int token);
extern _X_EXPORT Bool xf86IsOptionSet(const OptionInfoRec *table, int token);
@@ -110,9 +112,9 @@ extern _X_EXPORT Bool xf86GetOptValBool(const OptionInfoRec *table, int token, B
extern _X_EXPORT Bool xf86ReturnOptValBool(const OptionInfoRec *table, int token, Bool def);
extern _X_EXPORT int xf86NameCmp(const char *s1, const char *s2);
extern _X_EXPORT char *xf86NormalizeName(const char *s);
-extern _X_EXPORT pointer xf86ReplaceIntOption(pointer optlist, const char *name, const int val);
-extern _X_EXPORT pointer xf86ReplaceRealOption(pointer optlist, const char *name, const double val);
-extern _X_EXPORT pointer xf86ReplaceBoolOption(pointer optlist, const char *name, const Bool val);
-extern _X_EXPORT pointer xf86ReplacePercentOption(pointer optlist, const char *name, const double val);
-extern _X_EXPORT pointer xf86ReplaceStrOption(pointer optlist, const char *name, const char* val);
+extern _X_EXPORT XF86OptionPtr xf86ReplaceIntOption(XF86OptionPtr optlist, const char *name, const int val);
+extern _X_EXPORT XF86OptionPtr xf86ReplaceRealOption(XF86OptionPtr optlist, const char *name, const double val);
+extern _X_EXPORT XF86OptionPtr xf86ReplaceBoolOption(XF86OptionPtr optlist, const char *name, const Bool val);
+extern _X_EXPORT XF86OptionPtr xf86ReplacePercentOption(XF86OptionPtr optlist, const char *name, const double val);
+extern _X_EXPORT XF86OptionPtr xf86ReplaceStrOption(XF86OptionPtr optlist, const char *name, const char* val);
#endif
diff --git a/hw/xfree86/common/xf86Option.c b/hw/xfree86/common/xf86Option.c
index feef9fc..9e4f89b 100644
--- a/hw/xfree86/common/xf86Option.c
+++ b/hw/xfree86/common/xf86Option.c
@@ -40,11 +40,12 @@
#include <X11/X.h>
#include "os.h"
#include "xf86.h"
+#include "xf86Opt.h"
#include "xf86Xinput.h"
#include "xf86Optrec.h"
#include "xf86Parser.h"
-static Bool ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
+static Bool ParseOptionValue(int scrnIndex, XF86OptionPtr options, OptionInfoPtr p,
Bool markUsed);
/*
@@ -66,7 +67,7 @@ static Bool ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
*/
void
-xf86CollectOptions(ScrnInfoPtr pScrn, pointer extraOpts)
+xf86CollectOptions(ScrnInfoPtr pScrn, XF86OptionPtr extraOpts)
{
XF86OptionPtr tmp;
XF86OptionPtr extras = (XF86OptionPtr)extraOpts;
@@ -140,10 +141,10 @@ xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts)
* Duplicate the option list passed in. The returned pointer will be a newly
* allocated option list and must be freed by the caller.
*/
-pointer
-xf86OptionListDuplicate(pointer options)
+XF86OptionPtr
+xf86OptionListDuplicate(XF86OptionPtr options)
{
- pointer o = NULL;
+ XF86OptionPtr o = NULL;
while (options)
{
@@ -158,7 +159,7 @@ xf86OptionListDuplicate(pointer options)
/* Created for new XInput stuff -- essentially extensions to the parser */
static int
-LookupIntOption(pointer optlist, const char *name, int deflt, Bool markUsed)
+LookupIntOption(XF86OptionPtr optlist, const char *name, int deflt, Bool markUsed)
{
OptionInfoRec o;
@@ -171,7 +172,7 @@ LookupIntOption(pointer optlist, const char *name, int deflt, Bool markUsed)
static double
-LookupRealOption(pointer optlist, const char *name, double deflt,
+LookupRealOption(XF86OptionPtr optlist, const char *name, double deflt,
Bool markUsed)
{
OptionInfoRec o;
@@ -185,7 +186,7 @@ LookupRealOption(pointer optlist, const char *name, double deflt,
static char *
-LookupStrOption(pointer optlist, const char *name, char *deflt, Bool markUsed)
+LookupStrOption(XF86OptionPtr optlist, const char *name, char *deflt, Bool markUsed)
{
OptionInfoRec o;
@@ -201,7 +202,7 @@ LookupStrOption(pointer optlist, const char *name, char *deflt, Bool markUsed)
static int
-LookupBoolOption(pointer optlist, const char *name, int deflt, Bool markUsed)
+LookupBoolOption(XF86OptionPtr optlist, const char *name, int deflt, Bool markUsed)
{
OptionInfoRec o;
@@ -213,7 +214,7 @@ LookupBoolOption(pointer optlist, const char *name, int deflt, Bool markUsed)
}
static double
-LookupPercentOption(pointer optlist, const char *name, double deflt, Bool markUsed)
+LookupPercentOption(XF86OptionPtr optlist, const char *name, double deflt, Bool markUsed)
{
OptionInfoRec o;
@@ -227,34 +228,34 @@ LookupPercentOption(pointer optlist, const char *name, double deflt, Bool markUs
/* These xf86Set* functions are intended for use by non-screen specific code */
int
-xf86SetIntOption(pointer optlist, const char *name, int deflt)
+xf86SetIntOption(XF86OptionPtr optlist, const char *name, int deflt)
{
return LookupIntOption(optlist, name, deflt, TRUE);
}
double
-xf86SetRealOption(pointer optlist, const char *name, double deflt)
+xf86SetRealOption(XF86OptionPtr optlist, const char *name, double deflt)
{
return LookupRealOption(optlist, name, deflt, TRUE);
}
char *
-xf86SetStrOption(pointer optlist, const char *name, char *deflt)
+xf86SetStrOption(XF86OptionPtr optlist, const char *name, char *deflt)
{
return LookupStrOption(optlist, name, deflt, TRUE);
}
int
-xf86SetBoolOption(pointer optlist, const char *name, int deflt)
+xf86SetBoolOption(XF86OptionPtr optlist, const char *name, int deflt)
{
return LookupBoolOption(optlist, name, deflt, TRUE);
}
double
-xf86SetPercentOption(pointer optlist, const char *name, double deflt)
+xf86SetPercentOption(XF86OptionPtr optlist, const char *name, double deflt)
{
return LookupPercentOption(optlist, name, deflt, TRUE);
}
@@ -264,35 +265,35 @@ xf86SetPercentOption(pointer optlist, const char *name, double deflt)
* as used.
*/
int
-xf86CheckIntOption(pointer optlist, const char *name, int deflt)
+xf86CheckIntOption(XF86OptionPtr optlist, const char *name, int deflt)
{
return LookupIntOption(optlist, name, deflt, FALSE);
}
double
-xf86CheckRealOption(pointer optlist, const char *name, double deflt)
+xf86CheckRealOption(XF86OptionPtr optlist, const char *name, double deflt)
{
return LookupRealOption(optlist, name, deflt, FALSE);
}
char *
-xf86CheckStrOption(pointer optlist, const char *name, char *deflt)
+xf86CheckStrOption(XF86OptionPtr optlist, const char *name, char *deflt)
{
return LookupStrOption(optlist, name, deflt, FALSE);
}
int
-xf86CheckBoolOption(pointer optlist, const char *name, int deflt)
+xf86CheckBoolOption(XF86OptionPtr optlist, const char *name, int deflt)
{
return LookupBoolOption(optlist, name, deflt, FALSE);
}
double
-xf86CheckPercentOption(pointer optlist, const char *name, double deflt)
+xf86CheckPercentOption(XF86OptionPtr optlist, const char *name, double deflt)
{
return LookupPercentOption(optlist, name, deflt, FALSE);
}
@@ -300,44 +301,44 @@ xf86CheckPercentOption(pointer optlist, const char *name, double deflt)
* xf86AddNewOption() has the required property of replacing the option value
* if the option is already present.
*/
-pointer
-xf86ReplaceIntOption(pointer optlist, const char *name, const int val)
+XF86OptionPtr
+xf86ReplaceIntOption(XF86OptionPtr optlist, const char *name, const int val)
{
char tmp[16];
sprintf(tmp,"%i",val);
return xf86AddNewOption(optlist,name,tmp);
}
-pointer
-xf86ReplaceRealOption(pointer optlist, const char *name, const double val)
+XF86OptionPtr
+xf86ReplaceRealOption(XF86OptionPtr optlist, const char *name, const double val)
{
char tmp[32];
snprintf(tmp,32,"%f",val);
return xf86AddNewOption(optlist,name,tmp);
}
-pointer
-xf86ReplaceBoolOption(pointer optlist, const char *name, const Bool val)
+XF86OptionPtr
+xf86ReplaceBoolOption(XF86OptionPtr optlist, const char *name, const Bool val)
{
return xf86AddNewOption(optlist,name,val?"True":"False");
}
-pointer
-xf86ReplacePercentOption(pointer optlist, const char *name, const double val)
+XF86OptionPtr
+xf86ReplacePercentOption(XF86OptionPtr optlist, const char *name, const double val)
{
char tmp[16];
sprintf(tmp, "%lf%%", val);
return xf86AddNewOption(optlist,name,tmp);
}
-pointer
-xf86ReplaceStrOption(pointer optlist, const char *name, const char* val)
+XF86OptionPtr
+xf86ReplaceStrOption(XF86OptionPtr optlist, const char *name, const char* val)
{
return xf86AddNewOption(optlist,name,val);
}
-pointer
-xf86AddNewOption(pointer head, const char *name, const char *val)
+XF86OptionPtr
+xf86AddNewOption(XF86OptionPtr head, const char *name, const char *val)
{
/* XXX These should actually be allocated in the parser library. */
char *tmp = val ? strdup(val) : NULL;
@@ -347,51 +348,51 @@ xf86AddNewOption(pointer head, const char *name, const char *val)
}
-pointer
+XF86OptionPtr
xf86NewOption(char *name, char *value)
{
return xf86newOption(name, value);
}
-pointer
-xf86NextOption(pointer list)
+XF86OptionPtr
+xf86NextOption(XF86OptionPtr list)
{
return xf86nextOption(list);
}
-pointer
+XF86OptionPtr
xf86OptionListCreate(const char **options, int count, int used)
{
return xf86optionListCreate(options, count, used);
}
-pointer
-xf86OptionListMerge(pointer head, pointer tail)
+XF86OptionPtr
+xf86OptionListMerge(XF86OptionPtr head, XF86OptionPtr tail)
{
return xf86optionListMerge(head, tail);
}
void
-xf86OptionListFree(pointer opt)
+xf86OptionListFree(XF86OptionPtr opt)
{
xf86optionListFree(opt);
}
char *
-xf86OptionName(pointer opt)
+xf86OptionName(XF86OptionPtr opt)
{
return xf86optionName(opt);
}
char *
-xf86OptionValue(pointer opt)
+xf86OptionValue(XF86OptionPtr opt)
{
return xf86optionValue(opt);
}
void
-xf86OptionListReport(pointer parm)
+xf86OptionListReport(XF86OptionPtr parm)
{
XF86OptionPtr opts = parm;
@@ -407,30 +408,30 @@ xf86OptionListReport(pointer parm)
/* End of XInput-caused section */
-pointer
-xf86FindOption(pointer options, const char *name)
+XF86OptionPtr
+xf86FindOption(XF86OptionPtr options, const char *name)
{
return xf86findOption(options, name);
}
char *
-xf86FindOptionValue(pointer options, const char *name)
+xf86FindOptionValue(XF86OptionPtr options, const char *name)
{
return xf86findOptionValue(options, name);
}
void
-xf86MarkOptionUsed(pointer option)
+xf86MarkOptionUsed(XF86OptionPtr option)
{
if (option != NULL)
- ((XF86OptionPtr)option)->opt_used = TRUE;
+ option->opt_used = TRUE;
}
void
-xf86MarkOptionUsedByName(pointer options, const char *name)
+xf86MarkOptionUsedByName(XF86OptionPtr options, const char *name)
{
XF86OptionPtr opt;
@@ -440,16 +441,16 @@ xf86MarkOptionUsedByName(pointer options, const char *name)
}
Bool
-xf86CheckIfOptionUsed(pointer option)
+xf86CheckIfOptionUsed(XF86OptionPtr option)
{
if (option != NULL)
- return ((XF86OptionPtr)option)->opt_used;
+ return option->opt_used;
else
return FALSE;
}
Bool
-xf86CheckIfOptionUsedByName(pointer options, const char *name)
+xf86CheckIfOptionUsedByName(XF86OptionPtr options, const char *name)
{
XF86OptionPtr opt;
@@ -461,10 +462,8 @@ xf86CheckIfOptionUsedByName(pointer options, const char *name)
}
void
-xf86ShowUnusedOptions(int scrnIndex, pointer options)
+xf86ShowUnusedOptions(int scrnIndex, XF86OptionPtr opt)
{
- XF86OptionPtr opt = options;
-
while (opt) {
if (opt->opt_name && !opt->opt_used) {
xf86DrvMsg(scrnIndex, X_WARNING, "Option \"%s\" is not used\n",
@@ -482,7 +481,7 @@ GetBoolValue(OptionInfoPtr p, const char *s)
}
static Bool
-ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
+ParseOptionValue(int scrnIndex, XF86OptionPtr options, OptionInfoPtr p,
Bool markUsed)
{
char *s, *end;
@@ -695,7 +694,7 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
void
-xf86ProcessOptions(int scrnIndex, pointer options, OptionInfoPtr optinfo)
+xf86ProcessOptions(int scrnIndex, XF86OptionPtr options, OptionInfoPtr optinfo)
{
OptionInfoPtr p;
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 2bfeb9b..cecf4ff 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -276,7 +276,7 @@ ApplyAccelerationSettings(DeviceIntPtr dev){
*/
void
xf86ProcessCommonOptions(InputInfoPtr pInfo,
- pointer list)
+ XF86OptionPtr list)
{
if (xf86SetBoolOption(list, "Floating", 0) ||
!xf86SetBoolOption(list, "AlwaysCore", 1) ||
diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h
index 1b0b16f..a4d9e58 100644
--- a/hw/xfree86/common/xf86Xinput.h
+++ b/hw/xfree86/common/xf86Xinput.h
@@ -103,7 +103,7 @@ typedef struct _InputInfoRec {
char * type_name;
InputDriverPtr drv;
pointer module;
- pointer options;
+ XF86OptionPtr options;
InputAttributes *attrs;
} *InputInfoPtr;
@@ -144,7 +144,7 @@ extern _X_EXPORT void xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int ke
extern _X_EXPORT InputInfoPtr xf86FirstLocalDevice(void);
extern _X_EXPORT int xf86ScaleAxis(int Cx, int to_max, int to_min, int from_max, int from_min);
extern _X_EXPORT void xf86XInputSetScreen(InputInfoPtr pInfo, int screen_number, int x, int y);
-extern _X_EXPORT void xf86ProcessCommonOptions(InputInfoPtr pInfo, pointer options);
+extern _X_EXPORT void xf86ProcessCommonOptions(InputInfoPtr pInfo, XF86OptionPtr options);
extern _X_EXPORT void xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval,
int maxval, int resolution, int min_res,
int max_res, int mode);
diff --git a/hw/xfree86/doc/ddxDesign.xml b/hw/xfree86/doc/ddxDesign.xml
index 0290960..bc25c56 100644
--- a/hw/xfree86/doc/ddxDesign.xml
+++ b/hw/xfree86/doc/ddxDesign.xml
@@ -3175,7 +3175,7 @@ would not need to use these directly.
<blockquote><para>
<programlisting>
- pointer xf86FindOption(pointer options, const char *name);
+ XF86OptionPtr xf86FindOption(XF86OptionPtr options, const char *name);
</programlisting>
<blockquote><para>
Takes a list of options and an option name, and returns a handle
@@ -3187,7 +3187,7 @@ would not need to use these directly.
<blockquote><para>
<programlisting>
- char *xf86FindOptionValue(pointer options, const char *name);
+ char *xf86FindOptionValue(XF86OptionPtr options, const char *name);
</programlisting>
<blockquote><para>
Takes a list of options and an option name, and returns the value
@@ -3201,7 +3201,7 @@ would not need to use these directly.
<blockquote><para>
<programlisting>
- void xf86MarkOptionUsed(pointer option);
+ void xf86MarkOptionUsed(XF86OptionPtr option);
</programlisting>
<blockquote><para>
Takes a handle for an option, and marks that option as used.
@@ -3211,7 +3211,7 @@ would not need to use these directly.
<blockquote><para>
<programlisting>
- void xf86MarkOptionUsedByName(pointer options, const char *name);
+ void xf86MarkOptionUsedByName(XF86OptionPtr options, const char *name);
</programlisting>
<blockquote><para>
Takes a list of options and an option name and marks the first
@@ -3225,7 +3225,7 @@ Next, the higher level functions that most drivers would use.
</para>
<blockquote><para>
<programlisting>
- void xf86CollectOptions(ScrnInfoPtr pScrn, pointer extraOpts);
+ void xf86CollectOptions(ScrnInfoPtr pScrn, XF86OptionPtr extraOpts);
</programlisting>
<blockquote><para>
Collect the options from each of the config file sections used by
@@ -3245,7 +3245,7 @@ Next, the higher level functions that most drivers would use.
<blockquote><para>
<programlisting>
- void xf86ProcessOptions(int scrnIndex, pointer options,
+ void xf86ProcessOptions(int scrnIndex, XF86OptionPtr options,
OptionInfoPtr optinfo);
</programlisting>
<blockquote><para>
@@ -3354,7 +3354,7 @@ Next, the higher level functions that most drivers would use.
<blockquote><para>
<programlisting>
- void xf86ShowUnusedOptions(int scrnIndex, pointer options);
+ void xf86ShowUnusedOptions(int scrnIndex, XF86OptionPtr options);
</programlisting>
<blockquote><para>
Prints out warning messages for each option in the list of options
diff --git a/hw/xfree86/os-support/shared/posix_tty.c b/hw/xfree86/os-support/shared/posix_tty.c
index fb83860..cc12a31 100644
--- a/hw/xfree86/os-support/shared/posix_tty.c
+++ b/hw/xfree86/os-support/shared/posix_tty.c
@@ -112,7 +112,7 @@ GetBaud (int baudrate)
}
int
-xf86OpenSerial (pointer options)
+xf86OpenSerial (XF86OptionPtr options)
{
struct termios t;
int fd, i;
@@ -185,7 +185,7 @@ xf86OpenSerial (pointer options)
}
int
-xf86SetSerial (int fd, pointer options)
+xf86SetSerial (int fd, XF86OptionPtr options)
{
struct termios t;
int val;
diff --git a/hw/xfree86/os-support/xf86_OSproc.h b/hw/xfree86/os-support/xf86_OSproc.h
index f0cb768..fb64a34 100644
--- a/hw/xfree86/os-support/xf86_OSproc.h
+++ b/hw/xfree86/os-support/xf86_OSproc.h
@@ -129,6 +129,8 @@
_XFUNCPROTOBEGIN
+typedef struct _XF86OptionRec *XF86OptionPtr;
+
/* public functions */
extern _X_EXPORT Bool xf86LinearVidMem(void);
extern _X_EXPORT Bool xf86CheckMTRR(int);
@@ -145,8 +147,8 @@ extern _X_EXPORT void xf86SetRGBOut(void);
extern _X_EXPORT void xf86OSRingBell(int, int, int);
extern _X_EXPORT void xf86SetReallySlowBcopy(void);
extern _X_EXPORT void xf86SlowBcopy(unsigned char *, unsigned char *, int);
-extern _X_EXPORT int xf86OpenSerial(pointer options);
-extern _X_EXPORT int xf86SetSerial(int fd, pointer options);
+extern _X_EXPORT int xf86OpenSerial(XF86OptionPtr options);
+extern _X_EXPORT int xf86SetSerial(int fd, XF86OptionPtr options);
extern _X_EXPORT int xf86SetSerialSpeed(int fd, int speed);
extern _X_EXPORT int xf86ReadSerial(int fd, void *buf, int count);
extern _X_EXPORT int xf86WriteSerial(int fd, const void *buf, int count);
diff --git a/hw/xfree86/parser/xf86Optrec.h b/hw/xfree86/parser/xf86Optrec.h
index 5ccf728..acb3f40 100644
--- a/hw/xfree86/parser/xf86Optrec.h
+++ b/hw/xfree86/parser/xf86Optrec.h
@@ -81,7 +81,7 @@ GenericListRec, *GenericListPtr, *glp;
/*
* All options are stored using this data type.
*/
-typedef struct
+typedef struct _XF86OptionRec
{
GenericListRec list;
char *opt_name;
diff --git a/test/xfree86.c b/test/xfree86.c
index 2b591cf..7012e90 100644
--- a/test/xfree86.c
+++ b/test/xfree86.c
@@ -33,14 +33,15 @@
static void
xfree86_option_list_duplicate(void)
{
- pointer options;
- pointer duplicate;
+ XF86OptionPtr options;
+ XF86OptionPtr duplicate;
const char *o1 = "foo",
*o2 = "bar",
*v1 = "one",
*v2 = "two";
const char *o_null= "NULL";
char *val1, *val2;
+ XF86OptionPtr a, b;
duplicate = xf86OptionListDuplicate(NULL);
assert(!duplicate);
@@ -67,9 +68,9 @@ xfree86_option_list_duplicate(void)
assert(strcmp(val1, v2) == 0);
assert(strcmp(val1, val2) == 0);
- val1 = xf86FindOption(options, o_null);
- val2 = xf86FindOption(duplicate, o_null);
- assert(val1 && val2);
+ a = xf86FindOption(options, o_null);
+ b = xf86FindOption(duplicate, o_null);
+ assert(a && b);
}
int main(int argc, char** argv)
--
1.7.6
More information about the xorg-devel
mailing list