From af5c3b38e1c9897a7a53fa7285ea58aabb3963b9 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 11 Jun 2010 21:17:11 +0200 Subject: [PATCH] Avoid some more warnings from "gcc -Wwrite-strings". --- ChangeLog | 13 +++++++++++++ tests/test-argp.c | 2 +- tests/test-c-strcasestr.c | 4 ++-- tests/test-c-strstr.c | 4 ++-- tests/test-mbscasestr1.c | 4 ++-- tests/test-mbscasestr2.c | 4 ++-- tests/test-memmem.c | 4 ++-- tests/test-strcasestr.c | 6 +++--- tests/test-strstr.c | 6 +++--- 9 files changed, 30 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 84f2effbf3..a64e05c5c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2010-06-11 Bruno Haible + + Avoid some more warnings from "gcc -Wwrite-strings". + * tests/test-argp.c (test_optional): Change 5th and 6th argument type + to 'const char *'. + * tests/test-c-strstr.c (main): Add 'const' to variable declaration. + * tests/test-c-strcasestr.c (main): Likewise. + * tests/test-mbscasestr1.c (main): Likewise. + * tests/test-mbscasestr2.c (main): Likewise. + * tests/test-memmem.c (main): Likewise. + * tests/test-strstr.c (main): Likewise. + * tests/test-strcasestr.c (main): Likewise. + 2010-06-11 Ralf Wildenhues init.sh: change framework_failure_ to fail with status 99, not 1 diff --git a/tests/test-argp.c b/tests/test-argp.c index 7af1af81ad..85de5f4457 100644 --- a/tests/test-argp.c +++ b/tests/test-argp.c @@ -348,7 +348,7 @@ test6 (struct argp *argp) void test_optional (struct argp *argp, int argc, char **argv, - struct test_args *args, char *val, char *a) + struct test_args *args, const char *val, const char *a) { int index; if (argp_parse (argp, argc, argv, 0, &index, args)) diff --git a/tests/test-c-strcasestr.c b/tests/test-c-strcasestr.c index a97ea14142..73723c729a 100644 --- a/tests/test-c-strcasestr.c +++ b/tests/test-c-strcasestr.c @@ -63,7 +63,7 @@ main () { size_t repeat = 10000; size_t m = 1000000; - char *needle = + const char *needle = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaAaaaaaaAAAAaaaaaaa" "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; @@ -88,7 +88,7 @@ main () { size_t repeat = 10000; size_t m = 1000000; - char *haystack = + const char *haystack = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB"; char *needle = (char *) malloc (m + 1); diff --git a/tests/test-c-strstr.c b/tests/test-c-strstr.c index 41c49661f3..4dabc9c028 100644 --- a/tests/test-c-strstr.c +++ b/tests/test-c-strstr.c @@ -57,7 +57,7 @@ main () { size_t repeat = 10000; size_t m = 1000000; - char *needle = + const char *needle = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; char *haystack = (char *) malloc (m + 1); @@ -81,7 +81,7 @@ main () { size_t repeat = 10000; size_t m = 1000000; - char *haystack = + const char *haystack = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB"; char *needle = (char *) malloc (m + 1); diff --git a/tests/test-mbscasestr1.c b/tests/test-mbscasestr1.c index 29cbe03687..5f3c6e1987 100644 --- a/tests/test-mbscasestr1.c +++ b/tests/test-mbscasestr1.c @@ -58,7 +58,7 @@ main () { size_t repeat = 10000; size_t m = 1000000; - char *needle = + const char *needle = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaAaaaaaaAAAAaaaaaaa" "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; @@ -83,7 +83,7 @@ main () { size_t repeat = 10000; size_t m = 1000000; - char *haystack = + const char *haystack = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB"; char *needle = (char *) malloc (m + 1); diff --git a/tests/test-mbscasestr2.c b/tests/test-mbscasestr2.c index 1a95393dcf..4b4c6c9460 100644 --- a/tests/test-mbscasestr2.c +++ b/tests/test-mbscasestr2.c @@ -67,7 +67,7 @@ main () { size_t repeat = 10000; size_t m = 1000000; - char *needle = + const char *needle = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; char *haystack = (char *) malloc (m + 1); @@ -91,7 +91,7 @@ main () { size_t repeat = 10000; size_t m = 1000000; - char *haystack = + const char *haystack = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "A\303\207A\303\207A\303\207A\303\207A\303\207A\303\207A\303\207" "A\303\207A\303\207A\303\207A\303\207A\303\207A\303\207A\303\207" diff --git a/tests/test-memmem.c b/tests/test-memmem.c index a9d3558c2b..3a21213b0d 100644 --- a/tests/test-memmem.c +++ b/tests/test-memmem.c @@ -94,7 +94,7 @@ main (int argc, char *argv[]) { size_t repeat = 10000; size_t m = 1000000; - char *needle = + const char *needle = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; size_t n = strlen (needle); @@ -118,7 +118,7 @@ main (int argc, char *argv[]) { size_t repeat = 10000; size_t m = 1000000; - char *haystack = + const char *haystack = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB"; size_t n = strlen (haystack); diff --git a/tests/test-strcasestr.c b/tests/test-strcasestr.c index ed563b2f3e..1f38fad22e 100644 --- a/tests/test-strcasestr.c +++ b/tests/test-strcasestr.c @@ -1,5 +1,5 @@ /* Test of case-insensitive searching in a string. - Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2007-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -76,7 +76,7 @@ main () { size_t repeat = 10000; size_t m = 1000000; - char *needle = + const char *needle = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaAaaaaaaAAAAaaaaaaa" "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; @@ -101,7 +101,7 @@ main () { size_t repeat = 10000; size_t m = 1000000; - char *haystack = + const char *haystack = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB"; char *needle = (char *) malloc (m + 1); diff --git a/tests/test-strstr.c b/tests/test-strstr.c index b6845ab7de..1482e7de82 100644 --- a/tests/test-strstr.c +++ b/tests/test-strstr.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + * Copyright (C) 2004, 2007-2010 Free Software Foundation, Inc. * Written by Bruno Haible and Eric Blake * * This program is free software: you can redistribute it and/or modify @@ -96,7 +96,7 @@ main (int argc, char *argv[]) { size_t repeat = 10000; size_t m = 1000000; - char *needle = + const char *needle = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; char *haystack = (char *) malloc (m + 1); @@ -120,7 +120,7 @@ main (int argc, char *argv[]) { size_t repeat = 10000; size_t m = 1000000; - char *haystack = + const char *haystack = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "ABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABABAB"; char *needle = (char *) malloc (m + 1); -- 2.30.2