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"
static xf86ConfigSymTabRec DRITab[] = {
static const xf86ConfigSymTabRec DRITab[] = {
{ENDSECTION, "endsection"},
{GROUP, "group"},
{MODE, "mode"},

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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