From b93be14b7d339e4e46d941729dad853452fae8c0 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Sun, 17 Apr 2016 20:30:43 +0100 Subject: 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 Signed-off-by: Emil Velikov --- hw/xfree86/parser/DRI.c | 2 +- hw/xfree86/parser/Device.c | 3 +-- hw/xfree86/parser/Extensions.c | 2 +- hw/xfree86/parser/Files.c | 2 +- hw/xfree86/parser/Flags.c | 2 +- hw/xfree86/parser/Input.c | 3 +-- hw/xfree86/parser/InputClass.c | 3 +-- hw/xfree86/parser/Layout.c | 4 ++-- hw/xfree86/parser/Module.c | 4 ++-- hw/xfree86/parser/Monitor.c | 8 ++++---- hw/xfree86/parser/OutputClass.c | 3 +-- hw/xfree86/parser/Pointer.c | 4 ++-- hw/xfree86/parser/Screen.c | 4 ++-- hw/xfree86/parser/Vendor.c | 4 ++-- hw/xfree86/parser/Video.c | 4 ++-- hw/xfree86/parser/configProcs.h | 6 +++--- hw/xfree86/parser/read.c | 2 +- hw/xfree86/parser/scan.c | 10 +++++----- 18 files changed, 33 insertions(+), 37 deletions(-) diff --git a/hw/xfree86/parser/DRI.c b/hw/xfree86/parser/DRI.c index 9ed5b9ea9..31f447d05 100644 --- a/hw/xfree86/parser/DRI.c +++ b/hw/xfree86/parser/DRI.c @@ -37,7 +37,7 @@ #include "Configint.h" -static xf86ConfigSymTabRec DRITab[] = { +static const xf86ConfigSymTabRec DRITab[] = { {ENDSECTION, "endsection"}, {GROUP, "group"}, {MODE, "mode"}, diff --git a/hw/xfree86/parser/Device.c b/hw/xfree86/parser/Device.c index 7e49843bd..353d48c64 100644 --- a/hw/xfree86/parser/Device.c +++ b/hw/xfree86/parser/Device.c @@ -61,8 +61,7 @@ #include "Configint.h" -static -xf86ConfigSymTabRec DeviceTab[] = { +static const xf86ConfigSymTabRec DeviceTab[] = { {ENDSECTION, "endsection"}, {IDENTIFIER, "identifier"}, {VENDOR, "vendorname"}, diff --git a/hw/xfree86/parser/Extensions.c b/hw/xfree86/parser/Extensions.c index a6fcb56f0..3a2195901 100644 --- a/hw/xfree86/parser/Extensions.c +++ b/hw/xfree86/parser/Extensions.c @@ -41,7 +41,7 @@ #include "Configint.h" -static xf86ConfigSymTabRec ExtensionsTab[] = { +static const xf86ConfigSymTabRec ExtensionsTab[] = { {ENDSECTION, "endsection"}, {OPTION, "option"}, {-1, ""}, diff --git a/hw/xfree86/parser/Files.c b/hw/xfree86/parser/Files.c index 849bf92bb..c86ac7af2 100644 --- a/hw/xfree86/parser/Files.c +++ b/hw/xfree86/parser/Files.c @@ -61,7 +61,7 @@ #include "Configint.h" -static xf86ConfigSymTabRec FilesTab[] = { +static const xf86ConfigSymTabRec FilesTab[] = { {ENDSECTION, "endsection"}, {FONTPATH, "fontpath"}, {MODULEPATH, "modulepath"}, diff --git a/hw/xfree86/parser/Flags.c b/hw/xfree86/parser/Flags.c index 516966508..0f69734ba 100644 --- a/hw/xfree86/parser/Flags.c +++ b/hw/xfree86/parser/Flags.c @@ -63,7 +63,7 @@ #include "optionstr.h" -static xf86ConfigSymTabRec ServerFlagsTab[] = { +static const xf86ConfigSymTabRec ServerFlagsTab[] = { {ENDSECTION, "endsection"}, {NOTRAPSIGNALS, "notrapsignals"}, {DONTZAP, "dontzap"}, diff --git a/hw/xfree86/parser/Input.c b/hw/xfree86/parser/Input.c index cfacd4eee..88d19b6b5 100644 --- a/hw/xfree86/parser/Input.c +++ b/hw/xfree86/parser/Input.c @@ -62,8 +62,7 @@ #include "Configint.h" -static -xf86ConfigSymTabRec InputTab[] = { +static const xf86ConfigSymTabRec InputTab[] = { {ENDSECTION, "endsection"}, {IDENTIFIER, "identifier"}, {OPTION, "option"}, diff --git a/hw/xfree86/parser/InputClass.c b/hw/xfree86/parser/InputClass.c index 5d3b59ca5..392aa28ba 100644 --- a/hw/xfree86/parser/InputClass.c +++ b/hw/xfree86/parser/InputClass.c @@ -34,8 +34,7 @@ #include "Configint.h" -static -xf86ConfigSymTabRec InputClassTab[] = { +static const xf86ConfigSymTabRec InputClassTab[] = { {ENDSECTION, "endsection"}, {IDENTIFIER, "identifier"}, {OPTION, "option"}, diff --git a/hw/xfree86/parser/Layout.c b/hw/xfree86/parser/Layout.c index 0ace5da4a..2c829f4ee 100644 --- a/hw/xfree86/parser/Layout.c +++ b/hw/xfree86/parser/Layout.c @@ -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"}, diff --git a/hw/xfree86/parser/Module.c b/hw/xfree86/parser/Module.c index 0dcf4bac4..38bf777ed 100644 --- a/hw/xfree86/parser/Module.c +++ b/hw/xfree86/parser/Module.c @@ -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"}, diff --git a/hw/xfree86/parser/Monitor.c b/hw/xfree86/parser/Monitor.c index 0a8c08178..a33c968bc 100644 --- a/hw/xfree86/parser/Monitor.c +++ b/hw/xfree86/parser/Monitor.c @@ -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"}, diff --git a/hw/xfree86/parser/OutputClass.c b/hw/xfree86/parser/OutputClass.c index 3f2082ecb..8064e0cc0 100644 --- a/hw/xfree86/parser/OutputClass.c +++ b/hw/xfree86/parser/OutputClass.c @@ -32,8 +32,7 @@ #include "xf86tokens.h" #include "Configint.h" -static -xf86ConfigSymTabRec OutputClassTab[] = { +static const xf86ConfigSymTabRec OutputClassTab[] = { {ENDSECTION, "endsection"}, {IDENTIFIER, "identifier"}, {DRIVER, "driver"}, diff --git a/hw/xfree86/parser/Pointer.c b/hw/xfree86/parser/Pointer.c index 2f9d505ff..ff63deb31 100644 --- a/hw/xfree86/parser/Pointer.c +++ b/hw/xfree86/parser/Pointer.c @@ -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, ""}, diff --git a/hw/xfree86/parser/Screen.c b/hw/xfree86/parser/Screen.c index 47319706f..a831c30cd 100644 --- a/hw/xfree86/parser/Screen.c +++ b/hw/xfree86/parser/Screen.c @@ -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"}, diff --git a/hw/xfree86/parser/Vendor.c b/hw/xfree86/parser/Vendor.c index f137a4eb9..50ea68956 100644 --- a/hw/xfree86/parser/Vendor.c +++ b/hw/xfree86/parser/Vendor.c @@ -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"}, diff --git a/hw/xfree86/parser/Video.c b/hw/xfree86/parser/Video.c index 666b0ab9a..4e8526f3f 100644 --- a/hw/xfree86/parser/Video.c +++ b/hw/xfree86/parser/Video.c @@ -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"}, diff --git a/hw/xfree86/parser/configProcs.h b/hw/xfree86/parser/configProcs.h index 171f8e85f..7a46e0160 100644 --- a/hw/xfree86/parser/configProcs.h +++ b/hw/xfree86/parser/configProcs.h @@ -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 */ diff --git a/hw/xfree86/parser/read.c b/hw/xfree86/parser/read.c index 327c02a4d..ec038aeb1 100644 --- a/hw/xfree86/parser/read.c +++ b/hw/xfree86/parser/read.c @@ -61,7 +61,7 @@ #include "Configint.h" -static xf86ConfigSymTabRec TopLevelTab[] = { +static const xf86ConfigSymTabRec TopLevelTab[] = { {SECTION, "section"}, {-1, ""}, }; diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c index b8a08cf5d..2760439b6 100644 --- a/hw/xfree86/parser/scan.c +++ b/hw/xfree86/parser/scan.c @@ -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; -- cgit v1.2.3