summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2015-12-17 11:51:25 +0100
committerTobias Klauser <tklauser@distanz.ch>2015-12-17 11:51:25 +0100
commit6a95717c07d4b453531ebe52f55c6dcfa520dc80 (patch)
tree9a4691542f4212c07d1241c44ff512a44eaabe4c
parent126e0038a73b38fac7b3e03173b2d791734cc497 (diff)
cpp: Constify cpp argv passed to cpp_exec
Pass argv as char *const argv[] as execvp expects it. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-rw-r--r--bpf_parser.y4
-rw-r--r--cpp.c4
-rw-r--r--cpp.h2
-rw-r--r--trafgen_conf.h2
-rw-r--r--trafgen_parser.y4
5 files changed, 8 insertions, 8 deletions
diff --git a/bpf_parser.y b/bpf_parser.y
index 2c566a1..6f5f2b0 100644
--- a/bpf_parser.y
+++ b/bpf_parser.y
@@ -28,7 +28,7 @@
#include "cpp.h"
int compile_filter(char *file, int verbose, int bypass, int format,
- bool invoke_cpp, char **cpp_argv);
+ bool invoke_cpp, char *const cpp_argv[]);
static int curr_instr = 0;
@@ -735,7 +735,7 @@ static void pretty_printer(const struct sock_fprog *prog, int format)
}
int compile_filter(char *file, int verbose, int bypass, int format,
- bool invoke_cpp, char **cpp_argv)
+ bool invoke_cpp, char *const cpp_argv[])
{
int i;
struct sock_fprog res;
diff --git a/cpp.c b/cpp.c
index 8e03209..30a1404 100644
--- a/cpp.c
+++ b/cpp.c
@@ -5,7 +5,7 @@
#include "proc.h"
#include "xmalloc.h"
-static size_t argv_len(char **argv)
+static size_t argv_len(char *const argv[])
{
size_t len = 0;
@@ -15,7 +15,7 @@ static size_t argv_len(char **argv)
return len;
}
-int cpp_exec(char *in_file, char *out_file, size_t out_len, char **argv)
+int cpp_exec(char *in_file, char *out_file, size_t out_len, char *const argv[])
{
size_t argc = 7 + argv_len(argv);
char *tmp = xstrdup(in_file);
diff --git a/cpp.h b/cpp.h
index 45c42ac..1cf0a35 100644
--- a/cpp.h
+++ b/cpp.h
@@ -1,6 +1,6 @@
#ifndef CPP_H
#define CPP_H
-extern int cpp_exec(char *in_file, char *out_file, size_t out_len, char **argv);
+extern int cpp_exec(char *in_file, char *out_file, size_t out_len, char *const argv[]);
#endif
diff --git a/trafgen_conf.h b/trafgen_conf.h
index db3258f..b171798 100644
--- a/trafgen_conf.h
+++ b/trafgen_conf.h
@@ -57,7 +57,7 @@ static inline bool packet_dyn_has_only_csums(struct packet_dyn *p)
extern void compile_packets_str(char *str, bool verbose, unsigned int cpu);
extern void compile_packets(char *file, bool verbose, unsigned int cpu,
- bool invoke_cpp, char **cpp_argv);
+ bool invoke_cpp, char *const cpp_argv[]);
extern void cleanup_packets(void);
#endif /* TRAFGEN_CONF */
diff --git a/trafgen_parser.y b/trafgen_parser.y
index 24370ee..79a8439 100644
--- a/trafgen_parser.y
+++ b/trafgen_parser.y
@@ -590,8 +590,8 @@ void cleanup_packets(void)
free(packet_dyn);
}
-void compile_packets(char *file, bool verbose, unsigned int cpu, bool invoke_cpp,
- char **cpp_argv)
+void compile_packets(char *file, bool verbose, unsigned int cpu,
+ bool invoke_cpp, char *const cpp_argv[])
{
char tmp_file[128];
int ret = -1;