Make the filenames in the list constant.

This commit is contained in:
Andrew Wood
2023-08-14 22:37:23 +01:00
parent 7f25aff91d
commit cc4d1a15e4
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -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
}
+1 -1
View File
@@ -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)) {