xfree86/parser: annotate xf86ConfigSymTabRec as constant data

Add the const notation to all the static storage as well as the
functions that use it - xf86getToken(), xf86getSubTokenWithTab(),
StringToToken() and xf86getStringToken().

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
This commit is contained in:
Emil Velikov 2016-04-17 20:30:43 +01:00 committed by Adam Jackson
parent 3981dcdd48
commit b93be14b7d
18 changed files with 33 additions and 37 deletions

View File

@ -37,7 +37,7 @@
#include "Configint.h" #include "Configint.h"
static xf86ConfigSymTabRec DRITab[] = { static const xf86ConfigSymTabRec DRITab[] = {
{ENDSECTION, "endsection"}, {ENDSECTION, "endsection"},
{GROUP, "group"}, {GROUP, "group"},
{MODE, "mode"}, {MODE, "mode"},

View File

@ -61,8 +61,7 @@
#include "Configint.h" #include "Configint.h"
static static const xf86ConfigSymTabRec DeviceTab[] = {
xf86ConfigSymTabRec DeviceTab[] = {
{ENDSECTION, "endsection"}, {ENDSECTION, "endsection"},
{IDENTIFIER, "identifier"}, {IDENTIFIER, "identifier"},
{VENDOR, "vendorname"}, {VENDOR, "vendorname"},

View File

@ -41,7 +41,7 @@
#include "Configint.h" #include "Configint.h"
static xf86ConfigSymTabRec ExtensionsTab[] = { static const xf86ConfigSymTabRec ExtensionsTab[] = {
{ENDSECTION, "endsection"}, {ENDSECTION, "endsection"},
{OPTION, "option"}, {OPTION, "option"},
{-1, ""}, {-1, ""},

View File

@ -61,7 +61,7 @@
#include "Configint.h" #include "Configint.h"
static xf86ConfigSymTabRec FilesTab[] = { static const xf86ConfigSymTabRec FilesTab[] = {
{ENDSECTION, "endsection"}, {ENDSECTION, "endsection"},
{FONTPATH, "fontpath"}, {FONTPATH, "fontpath"},
{MODULEPATH, "modulepath"}, {MODULEPATH, "modulepath"},

View File

@ -63,7 +63,7 @@
#include "optionstr.h" #include "optionstr.h"
static xf86ConfigSymTabRec ServerFlagsTab[] = { static const xf86ConfigSymTabRec ServerFlagsTab[] = {
{ENDSECTION, "endsection"}, {ENDSECTION, "endsection"},
{NOTRAPSIGNALS, "notrapsignals"}, {NOTRAPSIGNALS, "notrapsignals"},
{DONTZAP, "dontzap"}, {DONTZAP, "dontzap"},

View File

@ -62,8 +62,7 @@
#include "Configint.h" #include "Configint.h"
static static const xf86ConfigSymTabRec InputTab[] = {
xf86ConfigSymTabRec InputTab[] = {
{ENDSECTION, "endsection"}, {ENDSECTION, "endsection"},
{IDENTIFIER, "identifier"}, {IDENTIFIER, "identifier"},
{OPTION, "option"}, {OPTION, "option"},

View File

@ -34,8 +34,7 @@
#include "Configint.h" #include "Configint.h"
static static const xf86ConfigSymTabRec InputClassTab[] = {
xf86ConfigSymTabRec InputClassTab[] = {
{ENDSECTION, "endsection"}, {ENDSECTION, "endsection"},
{IDENTIFIER, "identifier"}, {IDENTIFIER, "identifier"},
{OPTION, "option"}, {OPTION, "option"},

View File

@ -66,7 +66,7 @@
extern int xf86CheckBoolOption(void *optlist, const char *name, int deflt); extern int xf86CheckBoolOption(void *optlist, const char *name, int deflt);
static xf86ConfigSymTabRec LayoutTab[] = { static const xf86ConfigSymTabRec LayoutTab[] = {
{ENDSECTION, "endsection"}, {ENDSECTION, "endsection"},
{SCREEN, "screen"}, {SCREEN, "screen"},
{IDENTIFIER, "identifier"}, {IDENTIFIER, "identifier"},
@ -77,7 +77,7 @@ static xf86ConfigSymTabRec LayoutTab[] = {
{-1, ""}, {-1, ""},
}; };
static xf86ConfigSymTabRec AdjTab[] = { static const xf86ConfigSymTabRec AdjTab[] = {
{RIGHTOF, "rightof"}, {RIGHTOF, "rightof"},
{LEFTOF, "leftof"}, {LEFTOF, "leftof"},
{ABOVE, "above"}, {ABOVE, "above"},

View File

@ -61,13 +61,13 @@
#include "Configint.h" #include "Configint.h"
static xf86ConfigSymTabRec SubModuleTab[] = { static const xf86ConfigSymTabRec SubModuleTab[] = {
{ENDSUBSECTION, "endsubsection"}, {ENDSUBSECTION, "endsubsection"},
{OPTION, "option"}, {OPTION, "option"},
{-1, ""}, {-1, ""},
}; };
static xf86ConfigSymTabRec ModuleTab[] = { static const xf86ConfigSymTabRec ModuleTab[] = {
{ENDSECTION, "endsection"}, {ENDSECTION, "endsection"},
{LOAD, "load"}, {LOAD, "load"},
{DISABLE, "disable"}, {DISABLE, "disable"},

View File

@ -61,7 +61,7 @@
#include "Configint.h" #include "Configint.h"
static xf86ConfigSymTabRec MonitorTab[] = { static const xf86ConfigSymTabRec MonitorTab[] = {
{ENDSECTION, "endsection"}, {ENDSECTION, "endsection"},
{IDENTIFIER, "identifier"}, {IDENTIFIER, "identifier"},
{VENDOR, "vendorname"}, {VENDOR, "vendorname"},
@ -77,7 +77,7 @@ static xf86ConfigSymTabRec MonitorTab[] = {
{-1, ""}, {-1, ""},
}; };
static xf86ConfigSymTabRec ModesTab[] = { static const xf86ConfigSymTabRec ModesTab[] = {
{ENDSECTION, "endsection"}, {ENDSECTION, "endsection"},
{IDENTIFIER, "identifier"}, {IDENTIFIER, "identifier"},
{MODELINE, "modeline"}, {MODELINE, "modeline"},
@ -85,7 +85,7 @@ static xf86ConfigSymTabRec ModesTab[] = {
{-1, ""}, {-1, ""},
}; };
static xf86ConfigSymTabRec TimingTab[] = { static const xf86ConfigSymTabRec TimingTab[] = {
{TT_INTERLACE, "interlace"}, {TT_INTERLACE, "interlace"},
{TT_PHSYNC, "+hsync"}, {TT_PHSYNC, "+hsync"},
{TT_NHSYNC, "-hsync"}, {TT_NHSYNC, "-hsync"},
@ -101,7 +101,7 @@ static xf86ConfigSymTabRec TimingTab[] = {
{-1, ""}, {-1, ""},
}; };
static xf86ConfigSymTabRec ModeTab[] = { static const xf86ConfigSymTabRec ModeTab[] = {
{DOTCLOCK, "dotclock"}, {DOTCLOCK, "dotclock"},
{HTIMINGS, "htimings"}, {HTIMINGS, "htimings"},
{VTIMINGS, "vtimings"}, {VTIMINGS, "vtimings"},

View File

@ -32,8 +32,7 @@
#include "xf86tokens.h" #include "xf86tokens.h"
#include "Configint.h" #include "Configint.h"
static static const xf86ConfigSymTabRec OutputClassTab[] = {
xf86ConfigSymTabRec OutputClassTab[] = {
{ENDSECTION, "endsection"}, {ENDSECTION, "endsection"},
{IDENTIFIER, "identifier"}, {IDENTIFIER, "identifier"},
{DRIVER, "driver"}, {DRIVER, "driver"},

View File

@ -62,7 +62,7 @@
#include "Xprintf.h" #include "Xprintf.h"
static xf86ConfigSymTabRec PointerTab[] = { static const xf86ConfigSymTabRec PointerTab[] = {
{PROTOCOL, "protocol"}, {PROTOCOL, "protocol"},
{EMULATE3, "emulate3buttons"}, {EMULATE3, "emulate3buttons"},
{EM3TIMEOUT, "emulate3timeout"}, {EM3TIMEOUT, "emulate3timeout"},
@ -83,7 +83,7 @@ static xf86ConfigSymTabRec PointerTab[] = {
{-1, ""}, {-1, ""},
}; };
static xf86ConfigSymTabRec ZMapTab[] = { static const xf86ConfigSymTabRec ZMapTab[] = {
{XAXIS, "x"}, {XAXIS, "x"},
{YAXIS, "y"}, {YAXIS, "y"},
{-1, ""}, {-1, ""},

View File

@ -61,7 +61,7 @@
#include "Configint.h" #include "Configint.h"
static xf86ConfigSymTabRec DisplayTab[] = { static const xf86ConfigSymTabRec DisplayTab[] = {
{ENDSUBSECTION, "endsubsection"}, {ENDSUBSECTION, "endsubsection"},
{MODES, "modes"}, {MODES, "modes"},
{VIEWPORT, "viewport"}, {VIEWPORT, "viewport"},
@ -222,7 +222,7 @@ xf86parseDisplaySubSection(void)
#undef CLEANUP #undef CLEANUP
static xf86ConfigSymTabRec ScreenTab[] = { static const xf86ConfigSymTabRec ScreenTab[] = {
{ENDSECTION, "endsection"}, {ENDSECTION, "endsection"},
{IDENTIFIER, "identifier"}, {IDENTIFIER, "identifier"},
{MATCHSEAT, "matchseat"}, {MATCHSEAT, "matchseat"},

View File

@ -61,7 +61,7 @@
#include "Configint.h" #include "Configint.h"
static xf86ConfigSymTabRec VendorSubTab[] = { static const xf86ConfigSymTabRec VendorSubTab[] = {
{ENDSUBSECTION, "endsubsection"}, {ENDSUBSECTION, "endsubsection"},
{IDENTIFIER, "identifier"}, {IDENTIFIER, "identifier"},
{OPTION, "option"}, {OPTION, "option"},
@ -129,7 +129,7 @@ xf86parseVendorSubSection(void)
#undef CLEANUP #undef CLEANUP
static xf86ConfigSymTabRec VendorTab[] = { static const xf86ConfigSymTabRec VendorTab[] = {
{ENDSECTION, "endsection"}, {ENDSECTION, "endsection"},
{IDENTIFIER, "identifier"}, {IDENTIFIER, "identifier"},
{OPTION, "option"}, {OPTION, "option"},

View File

@ -61,7 +61,7 @@
#include "Configint.h" #include "Configint.h"
static xf86ConfigSymTabRec VideoPortTab[] = { static const xf86ConfigSymTabRec VideoPortTab[] = {
{ENDSUBSECTION, "endsubsection"}, {ENDSUBSECTION, "endsubsection"},
{IDENTIFIER, "identifier"}, {IDENTIFIER, "identifier"},
{OPTION, "option"}, {OPTION, "option"},
@ -128,7 +128,7 @@ xf86parseVideoPortSubSection(void)
#undef CLEANUP #undef CLEANUP
static xf86ConfigSymTabRec VideoAdaptorTab[] = { static const xf86ConfigSymTabRec VideoAdaptorTab[] = {
{ENDSECTION, "endsection"}, {ENDSECTION, "endsection"},
{IDENTIFIER, "identifier"}, {IDENTIFIER, "identifier"},
{VENDOR, "vendorname"}, {VENDOR, "vendorname"},

View File

@ -102,9 +102,9 @@ void xf86printVideoAdaptorSection(FILE * cf, XF86ConfVideoAdaptorPtr ptr);
void xf86freeVideoAdaptorList(XF86ConfVideoAdaptorPtr ptr); void xf86freeVideoAdaptorList(XF86ConfVideoAdaptorPtr ptr);
/* scan.c */ /* scan.c */
int xf86getToken(xf86ConfigSymTabRec * tab); int xf86getToken(const xf86ConfigSymTabRec * tab);
int xf86getSubToken(char **comment); int xf86getSubToken(char **comment);
int xf86getSubTokenWithTab(char **comment, xf86ConfigSymTabRec * tab); int xf86getSubTokenWithTab(char **comment, const xf86ConfigSymTabRec * tab);
void xf86unGetToken(int token); void xf86unGetToken(int token);
char *xf86tokenString(void); char *xf86tokenString(void);
void void
@ -116,7 +116,7 @@ _X_ATTRIBUTE_PRINTF(1, 2);
void void
xf86setSection(const char *section); xf86setSection(const char *section);
int int
xf86getStringToken(xf86ConfigSymTabRec * tab); xf86getStringToken(const xf86ConfigSymTabRec * tab);
/* write.c */ /* write.c */
/* DRI.c */ /* DRI.c */

View File

@ -61,7 +61,7 @@
#include "Configint.h" #include "Configint.h"
static xf86ConfigSymTabRec TopLevelTab[] = { static const xf86ConfigSymTabRec TopLevelTab[] = {
{SECTION, "section"}, {SECTION, "section"},
{-1, ""}, {-1, ""},
}; };

View File

@ -87,7 +87,7 @@
#define CONFIG_BUF_LEN 1024 #define CONFIG_BUF_LEN 1024
#define CONFIG_MAX_FILES 64 #define CONFIG_MAX_FILES 64
static int StringToToken(const char *, xf86ConfigSymTabRec *); static int StringToToken(const char *, const xf86ConfigSymTabRec *);
static struct { static struct {
FILE *file; FILE *file;
@ -247,7 +247,7 @@ xf86getNextLine(void)
* pushToken. * pushToken.
*/ */
int int
xf86getToken(xf86ConfigSymTabRec * tab) xf86getToken(const xf86ConfigSymTabRec * tab)
{ {
int c, i; int c, i;
@ -460,7 +460,7 @@ xf86getSubToken(char **comment)
/*NOTREACHED*/} /*NOTREACHED*/}
int int
xf86getSubTokenWithTab(char **comment, xf86ConfigSymTabRec * tab) xf86getSubTokenWithTab(char **comment, const xf86ConfigSymTabRec * tab)
{ {
int token; int token;
@ -1023,13 +1023,13 @@ xf86setSection(const char *section)
* Lookup a string if it is actually a token in disguise. * Lookup a string if it is actually a token in disguise.
*/ */
int int
xf86getStringToken(xf86ConfigSymTabRec * tab) xf86getStringToken(const xf86ConfigSymTabRec * tab)
{ {
return StringToToken(xf86_lex_val.str, tab); return StringToToken(xf86_lex_val.str, tab);
} }
static int static int
StringToToken(const char *str, xf86ConfigSymTabRec * tab) StringToToken(const char *str, const xf86ConfigSymTabRec * tab)
{ {
int i; int i;