diff options
author | Bruno Haible <bruno@clisp.org> | 2020-12-12 04:18:54 +0100 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2020-12-12 04:18:54 +0100 |
commit | c893594d0c33139efbc8d75e43eaed487116b58b (patch) | |
tree | 6e8f5d55f44b65d6e9567822b5da2cbf24351fbf /lib/csharpcomp.c | |
parent | 46c7e327c76f115bbdc6eee75fffa382559aa9d8 (diff) | |
download | gnulib-c893594d0c33139efbc8d75e43eaed487116b58b.tar.gz |
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.
Diffstat (limited to 'lib/csharpcomp.c')
-rw-r--r-- | lib/csharpcomp.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/lib/csharpcomp.c b/lib/csharpcomp.c index 57d2084b0a..cf4e2a50c5 100644 --- a/lib/csharpcomp.c +++ b/lib/csharpcomp.c @@ -76,7 +76,7 @@ compile_csharp_using_mono (const char * const *sources, "mcs --version >/dev/null 2>/dev/null" and (to exclude an unrelated 'mcs' program on QNX 6) "mcs --version 2>/dev/null | grep Mono >/dev/null" */ - char *argv[3]; + const char *argv[3]; pid_t child; int fd[1]; int exitstatus; @@ -121,8 +121,8 @@ compile_csharp_using_mono (const char * const *sources, if (mcs_present) { unsigned int argc; - char **argv; - char **argp; + const char **argv; + const char **argp; pid_t child; int fd[1]; FILE *fp; @@ -136,7 +136,7 @@ compile_csharp_using_mono (const char * const *sources, argc = 1 + (output_is_library ? 1 : 0) + 1 + libdirs_count + libraries_count + (debug ? 1 : 0) + sources_count; - argv = (char **) xmalloca ((argc + 1) * sizeof (char *)); + argv = (const char **) xmalloca ((argc + 1) * sizeof (const char *)); argp = argv; *argp++ = "mcs"; @@ -179,7 +179,7 @@ compile_csharp_using_mono (const char * const *sources, *argp++ = option; } else - *argp++ = (char *) source_file; + *argp++ = source_file; } *argp = NULL; /* Ensure argv length was correctly calculated. */ @@ -232,10 +232,10 @@ compile_csharp_using_mono (const char * const *sources, i < 1 + (output_is_library ? 1 : 0) + 1 + libdirs_count + libraries_count; i++) - freea (argv[i]); + freea ((char *) argv[i]); for (i = 0; i < sources_count; i++) if (argv[argc - sources_count + i] != sources[i]) - freea (argv[argc - sources_count + i]); + freea ((char *) argv[argc - sources_count + i]); freea (argv); return (exitstatus != 0); @@ -263,7 +263,7 @@ compile_csharp_using_sscli (const char * const *sources, /* Test for presence of csc: "csc -help >/dev/null 2>/dev/null \ && ! { csc -help 2>/dev/null | grep -i chicken > /dev/null; }" */ - char *argv[3]; + const char *argv[3]; pid_t child; int fd[1]; int exitstatus; @@ -312,20 +312,19 @@ compile_csharp_using_sscli (const char * const *sources, if (csc_present) { unsigned int argc; - char **argv; - char **argp; + const char **argv; + const char **argp; int exitstatus; unsigned int i; argc = 1 + 1 + 1 + libdirs_count + libraries_count + (optimize ? 1 : 0) + (debug ? 1 : 0) + sources_count; - argv = (char **) xmalloca ((argc + 1) * sizeof (char *)); + argv = (const char **) xmalloca ((argc + 1) * sizeof (const char *)); argp = argv; *argp++ = "csc"; - *argp++ = - (char *) (output_is_library ? "-target:library" : "-target:exe"); + *argp++ = (output_is_library ? "-target:library" : "-target:exe"); { char *option = (char *) xmalloca (5 + strlen (output_file) + 1); memcpy (option, "-out:", 5); @@ -365,7 +364,7 @@ compile_csharp_using_sscli (const char * const *sources, *argp++ = option; } else - *argp++ = (char *) source_file; + *argp++ = source_file; } *argp = NULL; /* Ensure argv length was correctly calculated. */ @@ -384,10 +383,10 @@ compile_csharp_using_sscli (const char * const *sources, true, true, NULL); for (i = 2; i < 3 + libdirs_count + libraries_count; i++) - freea (argv[i]); + freea ((char *) argv[i]); for (i = 0; i < sources_count; i++) if (argv[argc - sources_count + i] != sources[i]) - freea (argv[argc - sources_count + i]); + freea ((char *) argv[argc - sources_count + i]); freea (argv); return (exitstatus != 0); |