changeset 13410:78e99fa31037

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.
author Jim Meyering <meyering@redhat.com>
date Fri, 11 Jun 2010 11:03:54 +0200
parents 7f4981d27433
children 429328320118
files ChangeLog tests/test-xvasprintf.c
diffstat 2 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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.
--- a/tests/test-xvasprintf.c
+++ b/tests/test-xvasprintf.c
@@ -55,7 +55,7 @@
 
   {
     /* 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 @@
 }
 
 static void
-test_xasprintf ()
+test_xasprintf (void)
 {
   int repeat;
   char *result;
@@ -94,7 +94,7 @@
 
   {
     /* Silence gcc warning about zero-length format string.  */
-    char *empty = "";
+    const char *empty = "";
     result = xasprintf (empty);
     ASSERT (result != NULL);
     ASSERT (strcmp (result, "") == 0);