[Gmp-commit] /home/hgfiles/gmp: More of: Add 'const' to variables pointing to...

mercurial at gmplib.org mercurial at gmplib.org
Wed Nov 10 18:50:13 CET 2010


details:   /home/hgfiles/gmp/rev/aeaf5556321b
changeset: 13681:aeaf5556321b
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Wed Nov 10 18:50:08 2010 +0100
description:
More of: Add 'const' to variables pointing to character strings.

diffstat:

 tests/misc/t-locale.c |  14 +++++++-------
 tests/mpz/convert.c   |   2 +-
 tests/mpz/t-addsub.c  |   4 ++--
 tests/mpz/t-mul.c     |   4 ++--
 tests/mpz/t-perfpow.c |   2 +-
 5 files changed, 13 insertions(+), 13 deletions(-)

diffs (118 lines):

diff -r 7e78776b0993 -r aeaf5556321b tests/misc/t-locale.c
--- a/tests/misc/t-locale.c	Wed Nov 10 17:30:56 2010 +0100
+++ b/tests/misc/t-locale.c	Wed Nov 10 18:50:08 2010 +0100
@@ -42,7 +42,7 @@
 #include "tests.h"
 
 
-char *decimal_point;
+const char *decimal_point;
 
 /* Replace the libc localeconv with one we can manipulate. */
 #if HAVE_LOCALECONV
@@ -50,25 +50,25 @@
 localeconv (void)
 {
   static struct lconv  l;
-  l.decimal_point = decimal_point;
+  l.decimal_point = (char *) decimal_point;
   return &l;
 }
 #endif
 
 /* Replace the libc nl_langinfo with one we can manipulate. */
 #if HAVE_NL_LANGINFO
-const char *
+char *
 nl_langinfo (nl_item n)
 {
 #if defined (DECIMAL_POINT)
   if (n == DECIMAL_POINT)
-    return decimal_point;
+    return (char *) decimal_point;
 #endif
 #if defined (RADIXCHAR)
   if (n == RADIXCHAR)
-    return decimal_point;
+    return (char *) decimal_point;
 #endif
-  return "";
+  return (char *) "";
 }
 #endif
 
@@ -106,7 +106,7 @@
 
   for (i = 0; i < numberof (point); i++)
     {
-      decimal_point = point[i];
+      decimal_point = (const char *) point[i];
 
       for (neg = 0; neg <= 1; neg++)
         {
diff -r 7e78776b0993 -r aeaf5556321b tests/mpz/convert.c
--- a/tests/mpz/convert.c	Wed Nov 10 17:30:56 2010 +0100
+++ b/tests/mpz/convert.c	Wed Nov 10 18:50:08 2010 +0100
@@ -35,7 +35,7 @@
   mpz_t bs;
   unsigned long bsi;
   int d, l;
-  char *collseq = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+  const char *collseq = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
 
   mpz_init (bs);
 
diff -r 7e78776b0993 -r aeaf5556321b tests/mpz/t-addsub.c
--- a/tests/mpz/t-addsub.c	Wed Nov 10 17:30:56 2010 +0100
+++ b/tests/mpz/t-addsub.c	Wed Nov 10 18:50:08 2010 +0100
@@ -26,7 +26,7 @@
 #include "tests.h"
 
 void debug_mp __GMP_PROTO ((mpz_t, int));
-void dump_abort __GMP_PROTO ((int, char *, mpz_t, mpz_t));
+void dump_abort __GMP_PROTO ((int, const char *, mpz_t, mpz_t));
 
 int
 main (int argc, char **argv)
@@ -107,7 +107,7 @@
 }
 
 void
-dump_abort (int i, char *s, mpz_t op1, mpz_t op2)
+dump_abort (int i, const char *s, mpz_t op1, mpz_t op2)
 {
   fprintf (stderr, "ERROR: %s in test %d\n", s, i);
   fprintf (stderr, "op1 = "); debug_mp (op1, -16);
diff -r 7e78776b0993 -r aeaf5556321b tests/mpz/t-mul.c
--- a/tests/mpz/t-mul.c	Wed Nov 10 17:30:56 2010 +0100
+++ b/tests/mpz/t-mul.c	Wed Nov 10 18:50:08 2010 +0100
@@ -28,7 +28,7 @@
 
 void debug_mp __GMP_PROTO ((mpz_t));
 static void refmpz_mul __GMP_PROTO ((mpz_t, const mpz_t, const mpz_t));
-void dump_abort __GMP_PROTO ((int, char *, mpz_t, mpz_t, mpz_t, mpz_t));
+void dump_abort __GMP_PROTO ((int, const char *, mpz_t, mpz_t, mpz_t, mpz_t));
 
 #define FFT_MIN_BITSIZE 100000
 
@@ -178,7 +178,7 @@
 }
 
 void
-dump_abort (int i, char *s,
+dump_abort (int i, const char *s,
             mpz_t op1, mpz_t op2, mpz_t product, mpz_t ref_product)
 {
   mp_size_t b, e;
diff -r 7e78776b0993 -r aeaf5556321b tests/mpz/t-perfpow.c
--- a/tests/mpz/t-perfpow.c	Wed Nov 10 17:30:56 2010 +0100
+++ b/tests/mpz/t-perfpow.c	Wed Nov 10 18:50:08 2010 +0100
@@ -28,7 +28,7 @@
 
 struct
 {
-  char *num_as_str;
+  const char *num_as_str;
   char want;
 } tests[] =
   {


More information about the gmp-commit mailing list