From cc4d1a15e4ecf447079605dd2656fa98842aeb70 Mon Sep 17 00:00:00 2001 From: Andrew Wood Date: Mon, 14 Aug 2023 22:37:23 +0100 Subject: [PATCH] Make the filenames in the list constant. --- src/include/options.h | 4 ++-- src/main/options.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/include/options.h b/src/include/options.h index 4555b88..a06fdf4 100644 --- a/src/include/options.h +++ b/src/include/options.h @@ -56,7 +56,7 @@ struct opts_s { /* structure describing run-time options */ /*@keep@*/ /*@null@*/ char *format; /* output format, if any */ /*@keep@*/ /*@null@*/ char *pidfile; /* PID file, if any */ unsigned int argc; /* number of non-option arguments */ - /*@keep@*/ /*@null@*/ char **argv; /* array of non-option arguments */ + /*@keep@*/ /*@null@*/ const char **argv; /* array of non-option arguments */ unsigned int argv_length; /* allocated array size */ }; @@ -65,7 +65,7 @@ struct opts_s { /* structure describing run-time options */ extern /*@null@*/ /*@only@*/ opts_t opts_parse(unsigned int, char **); extern void opts_free(/*@only@*/ opts_t); -extern bool opts_add_file(opts_t, char *); +extern bool opts_add_file(opts_t, const char *); #ifdef __cplusplus } diff --git a/src/main/options.c b/src/main/options.c index d079cad..53a7494 100644 --- a/src/main/options.c +++ b/src/main/options.c @@ -88,7 +88,7 @@ void opts_free( /*@only@ */ opts_t opts) * Add a filename to the list of non-option arguments, returning false on * error. The filename is not copied - the pointer is stored. */ -bool opts_add_file(opts_t opts, char *filename) +bool opts_add_file(opts_t opts, const char *filename) { /*@-branchstate@ */ if ((opts->argc >= opts->argv_length) || (NULL == opts->argv)) {