From fdbcdb5b7d491d054b1ed0105c09f5192355c38c Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Thu, 23 Apr 2020 14:16:49 +0200 Subject: [PATCH] apply const qualifier appropriately --- src/frontend/arg.c | 4 +++- src/frontend/arg.h | 2 +- src/include/ngspice/cpdefs.h | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/frontend/arg.c b/src/frontend/arg.c index 6a09b1c86..268c62adc 100644 --- a/src/frontend/arg.c +++ b/src/frontend/arg.c @@ -78,10 +78,12 @@ arg_plot(const wordlist *wl, const struct comm *command) void -arg_load(wordlist *wl, const struct comm *command) +arg_load(const wordlist *wl_in, const struct comm *command) { /* just call com_load */ + wordlist* const wl = wl_copy(wl_in); command->co_func(wl); + wl_free(wl); } diff --git a/src/frontend/arg.h b/src/frontend/arg.h index de9ec6f09..7c049b45d 100644 --- a/src/frontend/arg.h +++ b/src/frontend/arg.h @@ -10,7 +10,7 @@ char *prompt(FILE *fp); wordlist *process(wordlist *wlist); void arg_print(const wordlist *wl, const struct comm *command); void arg_plot(const wordlist *wl, const struct comm *command); -void arg_load(wordlist *wl, const struct comm *command); +void arg_load(const wordlist *wl, const struct comm *command); void arg_let(const wordlist *wl, const struct comm *command); void arg_set(const wordlist *wl, const struct comm *command); void arg_display(const wordlist *wl, const struct comm *command); diff --git a/src/include/ngspice/cpdefs.h b/src/include/ngspice/cpdefs.h index 8fc78dfd8..a29190288 100644 --- a/src/include/ngspice/cpdefs.h +++ b/src/include/ngspice/cpdefs.h @@ -41,7 +41,7 @@ struct comm { int co_maxargs; /* The fn that prompts the user. */ - void (*co_argfn) (wordlist *wl, struct comm *command); + void (*co_argfn) (const wordlist *wl, const struct comm *command); /* When these are printed, printf(string, av[0]) .. */ char *co_help;