add const qualifiers

Eric Blake <[email protected]>
Newsgroups gmane.comp.gnu.m4.patches
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jim noticed on coreutils that several array declarations were lacking
const designation, even though their elements are never modified, so I
checked m4 for the same issue.  I'm applying this.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             [email protected]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhWaGcACgkQ84KuGfSFAYBmUwCgxgaqnGe56qE+6L7PkCbIS018
lJMAoIxazujy0/aGuokcHlIJQt4oHE/b
=twTm
-----END PGP SIGNATURE-----

_______________________________________________
M4-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/m4-patches
m4.patch358 (text/plain, 8.8 KB)
From b4c7d8547c2072cf84237d2abd3474c17b009081 Mon Sep 17 00:00:00 2001
From: Eric Blake <[email protected]>
Date: Mon, 16 Jun 2008 07:09:24 -0600
Subject: [PATCH] Add missing const qualifications.

* m4/resyntax.c (m4_resyntax_map): Declare array elements as
const.
* modules/gnu.c (m4_builtin_table, m4_macro_table): Likewise.
* modules/import.c (m4_builtin_table): Likewise.
* modules/load.c (m4_builtin_table, m4_macro_table): Likewise.
* modules/m4.c (m4_builtin_table): Likewise.
* modules/modtest.c (m4_builtin_table, m4_macro_table): Likewise.
* modules/mpeval.c (m4_builtin_table, m4_macro_table): Likewise.
* modules/perl.c (m4_builtin_table, m4_macro_table): Likewise.
* modules/shadow.c (m4_builtin_table, m4_macro_table): Likewise.
* modules/stdlib.c (m4_builtin_table): Likewise.
* modules/time.c (m4_builtin_table): Likewise.
* modules/traditional.c (m4_macro_table): Likewise.

Signed-off-by: Eric Blake <[email protected]>
---
 ChangeLog             |   17 +++++++++++++++++
 m4/resyntax.c         |    4 ++--
 modules/gnu.c         |    4 ++--
 modules/import.c      |    2 +-
 modules/load.c        |    4 ++--
 modules/m4.c          |    2 +-
 modules/modtest.c     |    4 ++--
 modules/mpeval.c      |    4 ++--
 modules/perl.c        |    4 ++--
 modules/shadow.c      |    4 ++--
 modules/stdlib.c      |    2 +-
 modules/time.c        |    2 +-
 modules/traditional.c |    2 +-
 13 files changed, 36 insertions(+), 19 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b2f0cc4..19631a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2008-06-16  Eric Blake  <[email protected]>
+
+	Add missing const qualifications.
+	* m4/resyntax.c (m4_resyntax_map): Declare array elements as
+	const.
+	* modules/gnu.c (m4_builtin_table, m4_macro_table): Likewise.
+	* modules/import.c (m4_builtin_table): Likewise.
+	* modules/load.c (m4_builtin_table, m4_macro_table): Likewise.
+	* modules/m4.c (m4_builtin_table): Likewise.
+	* modules/modtest.c (m4_builtin_table, m4_macro_table): Likewise.
+	* modules/mpeval.c (m4_builtin_table, m4_macro_table): Likewise.
+	* modules/perl.c (m4_builtin_table, m4_macro_table): Likewise.
+	* modules/shadow.c (m4_builtin_table, m4_macro_table): Likewise.
+	* modules/stdlib.c (m4_builtin_table): Likewise.
+	* modules/time.c (m4_builtin_table): Likewise.
+	* modules/traditional.c (m4_macro_table): Likewise.
+
 2008-06-10  Eric Blake  <[email protected]>
 
 	Avoid corrupted frozen file if NUL appears on block boundary.
diff --git a/m4/resyntax.c b/m4/resyntax.c
index 62e831d..8be3038 100644
--- a/m4/resyntax.c
+++ b/m4/resyntax.c
@@ -1,5 +1,5 @@
 /* GNU m4 -- A simple macro processor
-   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
 
    This file is part of GNU M4.
 
@@ -33,7 +33,7 @@ typedef struct {
    the mappings will break programs that load a frozen file made before
    such a change...  */
 
-static m4_resyntax m4_resyntax_map[] =
+static m4_resyntax const m4_resyntax_map[] =
 {
   /* First, the canonical definitions for reverse lookups:  */
 
diff --git a/modules/gnu.c b/modules/gnu.c
index ead1b62..99df3ef 100644
--- a/modules/gnu.c
+++ b/modules/gnu.c
@@ -68,7 +68,7 @@
 
 
 /* Generate a table for mapping m4 symbol names to handler functions. */
-m4_builtin m4_builtin_table[] =
+const m4_builtin m4_builtin_table[] =
 {
 #define BUILTIN(handler, macros, blind, side, min, max)			\
   M4BUILTIN_ENTRY (handler, #handler, macros, blind, side, min, max)
@@ -81,7 +81,7 @@ m4_builtin m4_builtin_table[] =
 
 
 /* A table for mapping m4 symbol names to simple expansion text. */
-m4_macro m4_macro_table[] =
+const m4_macro m4_macro_table[] =
 {
   /* name		text	min	max */
 #if UNIX
diff --git a/modules/import.c b/modules/import.c
index 8b5fc05..2c9551a 100644
--- a/modules/import.c
+++ b/modules/import.c
@@ -40,7 +40,7 @@
   builtin_functions
 #undef BUILTIN
 
-m4_builtin m4_builtin_table[] =
+const m4_builtin m4_builtin_table[] =
 {
 #define BUILTIN(handler, macros, blind, side, min, max)			\
   M4BUILTIN_ENTRY (handler, #handler, macros, blind, side, min, max)
diff --git a/modules/load.c b/modules/load.c
index e169796..c943702 100644
--- a/modules/load.c
+++ b/modules/load.c
@@ -48,7 +48,7 @@
 
 
 /* Generate a table for mapping m4 symbol names to handler functions. */
-m4_builtin m4_builtin_table[] =
+const m4_builtin m4_builtin_table[] =
 {
 #define BUILTIN(handler, macros, blind, side, min, max)			\
   M4BUILTIN_ENTRY (handler, #handler, macros, blind, side, min, max)
@@ -61,7 +61,7 @@ m4_builtin m4_builtin_table[] =
 
 
 /* A table for mapping m4 symbol names to simple expansion text. */
-m4_macro m4_macro_table[] =
+const m4_macro m4_macro_table[] =
 {
   /* name		text	min	max */
   { "__load__",		"",	0,	0 },
diff --git a/modules/m4.c b/modules/m4.c
index d9e789e..b993ec4 100644
--- a/modules/m4.c
+++ b/modules/m4.c
@@ -115,7 +115,7 @@ static void	numb_obstack	(m4_obstack *obs, number value,
 
 
 /* Generate a table for mapping m4 symbol names to handler functions. */
-m4_builtin m4_builtin_table[] =
+const m4_builtin m4_builtin_table[] =
 {
 #define BUILTIN(handler, macros, blind, side, min, max)			\
   M4BUILTIN_ENTRY (handler, #handler, macros, blind, side, min, max)
diff --git a/modules/modtest.c b/modules/modtest.c
index ab23f5f..9a0219b 100644
--- a/modules/modtest.c
+++ b/modules/modtest.c
@@ -44,7 +44,7 @@ extern bool export_test (const char *foo);
   builtin_functions
 #undef BUILTIN
 
-m4_builtin m4_builtin_table[] =
+const m4_builtin m4_builtin_table[] =
 {
 #define BUILTIN(handler, macros, blind, side, min, max)			\
   M4BUILTIN_ENTRY (handler, #handler, macros, blind, side, min, max)
@@ -55,7 +55,7 @@ m4_builtin m4_builtin_table[] =
   { NULL, NULL, 0, 0, 0 },
 };
 
-m4_macro m4_macro_table[] =
+const m4_macro m4_macro_table[] =
 {
   /* name		text		min	max */
   { "__test__",		"`modtest'",	0,	0 },
diff --git a/modules/mpeval.c b/modules/mpeval.c
index 7bd2139..63cd56a 100644
--- a/modules/mpeval.c
+++ b/modules/mpeval.c
@@ -106,7 +106,7 @@
 
 
 /* Generate a table for mapping m4 symbol names to handler functions. */
-m4_builtin m4_builtin_table[] =
+const m4_builtin m4_builtin_table[] =
 {
 #define BUILTIN(handler, macros, blind, side, min, max)			\
   M4BUILTIN_ENTRY (handler, #handler, macros, blind, side, min, max)
@@ -119,7 +119,7 @@ m4_builtin m4_builtin_table[] =
 
 
 /* A table for mapping m4 symbol names to simple expansion text. */
-m4_macro m4_macro_table[] =
+const m4_macro m4_macro_table[] =
 {
   /* name		text	min	max */
   { "__mpeval__",	"",	0,	0 },
diff --git a/modules/perl.c b/modules/perl.c
index 811a114..6b4f1f5 100644
--- a/modules/perl.c
+++ b/modules/perl.c
@@ -46,7 +46,7 @@
   builtin_functions
 #undef BUILTIN
 
-m4_builtin m4_builtin_table[] =
+const m4_builtin m4_builtin_table[] =
 {
 #define BUILTIN(handler, macros, blind, side, min, max)			\
   M4BUILTIN_ENTRY (handler, #handler, macros, blind, side, min, max)
@@ -58,7 +58,7 @@ m4_builtin m4_builtin_table[] =
 };
 
 /* A table for mapping m4 symbol names to simple expansion text. */
-m4_macro m4_macro_table[] =
+const m4_macro m4_macro_table[] =
 {
   /* name		text	min	max */
   { "__perleval__",	"",	0,	0 },
diff --git a/modules/shadow.c b/modules/shadow.c
index db8515e..be66bb6 100644
--- a/modules/shadow.c
+++ b/modules/shadow.c
@@ -42,7 +42,7 @@
   builtin_functions
 #undef BUILTIN
 
-m4_builtin m4_builtin_table[] =
+const m4_builtin m4_builtin_table[] =
 {
 #define BUILTIN(handler, macros, blind, side, min, max)			\
   M4BUILTIN_ENTRY (handler, #handler, macros, blind, side, min, max)
@@ -53,7 +53,7 @@ m4_builtin m4_builtin_table[] =
   { NULL, NULL, 0, 0, 0 },
 };
 
-m4_macro m4_macro_table[] =
+const m4_macro m4_macro_table[] =
 {
   /* name		text		min	max */
   { "__test__",		"`shadow'",	0,	0 },
diff --git a/modules/stdlib.c b/modules/stdlib.c
index 0fd492f..b60e977 100644
--- a/modules/stdlib.c
+++ b/modules/stdlib.c
@@ -61,7 +61,7 @@
   builtin_functions
 #undef BUILTIN
 
-m4_builtin m4_builtin_table[] =
+const m4_builtin m4_builtin_table[] =
 {
 #define BUILTIN(handler, macros, blind, side, min, max)			\
   M4BUILTIN_ENTRY (handler, #handler, macros, blind, side, min, max)
diff --git a/modules/time.c b/modules/time.c
index 62f3da6..a922a67 100644
--- a/modules/time.c
+++ b/modules/time.c
@@ -61,7 +61,7 @@
 # endif
 #undef BUILTIN
 
-m4_builtin m4_builtin_table[] =
+const m4_builtin m4_builtin_table[] =
 {
 #define BUILTIN(handler, macros, blind, side, min, max)			\
   M4BUILTIN_ENTRY (handler, #handler, macros, blind, side, min, max)
diff --git a/modules/traditional.c b/modules/traditional.c
index 13a112d..15ad655 100644
--- a/modules/traditional.c
+++ b/modules/traditional.c
@@ -31,7 +31,7 @@
 #define m4_macro_table		traditional_LTX_m4_macro_table
 
 /* A table for mapping m4 symbol names to simple expansion text. */
-m4_macro m4_macro_table[] =
+const m4_macro m4_macro_table[] =
 {
   /* name		text	min	max */
 #if UNIX
-- 
1.5.5.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.