test-xvasprintf: avoid 'const' discard warnings
authorJim Meyering <meyering@redhat.com>
Fri, 11 Jun 2010 09:03:54 +0000 (11:03 +0200)
committerJim Meyering <meyering@redhat.com>
Fri, 11 Jun 2010 09:12:37 +0000 (11:12 +0200)
* tests/test-xvasprintf.c (test_xvasprintf, test_xasprintf): Use
"const" when assigning from literal strings.
(test_xasprintf): Add "void" in function argument list to placate
-Wstrict-prototypes and to be consistent with test_xvasprintf above.

ChangeLog
tests/test-xvasprintf.c

index d96f7fe..456a793 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2010-06-11  Jim Meyering  <meyering@redhat.com>
 
+       test-xvasprintf: avoid 'const' discard warnings
+       * tests/test-xvasprintf.c (test_xvasprintf, test_xasprintf): Use
+       "const" when assigning from literal strings.
+       (test_xasprintf): Add "void" in function argument list to placate
+       -Wstrict-prototypes and to be consistent with test_xvasprintf above.
+
        tests: avoid compilation warnings in argmatch and exclude tests...
        in packages that define ARGMATCH_DIE_DECL, like coreutils.
        * tests/test-exclude.c [ARGMATCH_DIE_DECL]: Also declare the function.
index df6c200..023067a 100644 (file)
@@ -55,7 +55,7 @@ test_xvasprintf (void)
 
   {
     /* Silence gcc warning about zero-length format string.  */
-    char *empty = "";
+    const char *empty = "";
     result = my_xasprintf (empty);
     ASSERT (result != NULL);
     ASSERT (strcmp (result, "") == 0);
@@ -79,7 +79,7 @@ test_xvasprintf (void)
 }
 
 static void
-test_xasprintf ()
+test_xasprintf (void)
 {
   int repeat;
   char *result;
@@ -94,7 +94,7 @@ test_xasprintf ()
 
   {
     /* Silence gcc warning about zero-length format string.  */
-    char *empty = "";
+    const char *empty = "";
     result = xasprintf (empty);
     ASSERT (result != NULL);
     ASSERT (strcmp (result, "") == 0);