[PATCH xserver 1/4] xfree86/parser: annotate xf86ConfigSymTabRec as constant data

Emil Velikov emil.l.velikov at gmail.com
Sun Apr 17 19:30:43 UTC 2016


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

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 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 9ed5b9e..31f447d 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 7e49843..353d48c 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 a6fcb56..3a21959 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 849bf92..c86ac7a 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 5169665..0f69734 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 cfacd4e..88d19b6 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 5d3b59c..392aa28 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 0ace5da..2c829f4 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 0dcf4ba..38bf777 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 0a8c081..a33c968 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 3f2082e..8064e0c 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 2f9d505..ff63deb 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 4731970..a831c30 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 f137a4e..50ea689 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 666b0ab..4e8526f 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 171f8e8..7a46e01 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 327c02a..ec038ae 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 b8a08cf..2760439 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;
 
-- 
2.8.0



More information about the xorg-devel mailing list