From c893594d0c33139efbc8d75e43eaed487116b58b Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 12 Dec 2020 04:18:54 +0100 Subject: sh-quote, execute, spawn-pipe, etc.: Make better use of 'const'. * lib/sh-quote.h (shell_quote_argv): Does not need write access to the elements of argv. * lib/sh-quote.c (shell_quote_argv): Likewise. * lib/windows-spawn.h (prepare_spawn): Add 'const' the argument type and the return type. * lib/windows-spawn.c (prepare_spawn): Likewise. * lib/os2-spawn.h (prepare_spawn): Likewise. * lib/os2-spawn.c (prepare_spawn): Likewise. * lib/execute.h (execute): Does not need write access to the elements of prog_argv. * lib/execute.c (execute): Likewise. * lib/spawn-pipe.h (create_pipe_out, create_pipe_in, create_pipe_bidi): Likewise. * lib/spawn-pipe.c (create_pipe, create_pipe_bidi, create_pipe_in, create_pipe_out): Likewise. * lib/pipe-filter.h (pipe_filter_ii_execute, pipe_filter_gi_create): Likewise. * lib/pipe-filter-ii.c (pipe_filter_ii_execute): Likewise. * lib/pipe-filter-gi.c (pipe_filter_gi_create): Likewise. * lib/javaexec.h (execute_fn): Does not need write access to the elements of prog_argv. * lib/javaexec.c (execute_java_class): Update variable types and remove casts to 'char *'. * lib/csharpexec.h (execute_fn): Does not need write access to the elements of prog_argv. * lib/csharpexec.c (execute_csharp_using_mono, execute_csharp_using_sscli): Update variable types and remove casts to 'char *'. * lib/javacomp.c (compile_using_envjavac, compile_using_gcj, compile_using_javac, compile_using_jikes, is_envjavac_gcj, is_envjavac_gcj43, is_gcj_present, is_gcj_43, is_javac_present, is_jikes_present): Update variable types and remove casts to 'char *'. * lib/javaversion.c (execute_and_read_line): Does not need write access to the elements of prog_argv. * lib/csharpcomp.c (compile_csharp_using_mono, compile_csharp_using_sscli): Update variable types and remove casts to 'char *'. * tests/test-sh-quote.c (main): Update variable types and remove casts to 'char *'. * tests/test-execute-main.c (main): Update variable types and remove casts to 'char *'. * tests/test-spawn-pipe-main.c (test_pipe): Update variable types and remove casts to 'char *'. * NEWS: Mention the changes. --- tests/test-spawn-pipe-main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/test-spawn-pipe-main.c') diff --git a/tests/test-spawn-pipe-main.c b/tests/test-spawn-pipe-main.c index fe4f94ecaa..cc61f8eea7 100644 --- a/tests/test-spawn-pipe-main.c +++ b/tests/test-spawn-pipe-main.c @@ -44,13 +44,13 @@ static void test_pipe (const char *prog, bool stderr_closed) { int fd[2]; - char *argv[3]; + const char *argv[3]; pid_t pid; char buffer[2] = { 'a', 't' }; /* Set up child. */ - argv[0] = (char *) prog; - argv[1] = (char *) (stderr_closed ? "1" : "0"); + argv[0] = prog; + argv[1] = (stderr_closed ? "1" : "0"); argv[2] = NULL; pid = create_pipe_bidi (prog, prog, argv, NULL, false, true, true, fd); ASSERT (0 <= pid); -- cgit v1.2.1