Browse Source

Remove unused global variable cp_dol.

This also prevents a gcc 13 bug, as cp_dol has been set to '\0'
by -O2 optimization (see
https://stackoverflow.com/questions/77407156/s-0-being-optimized-out-possible-gcc-13-bug-or-some-undefined-behaviour)
pre-master-46
Holger Vogt 2 years ago
parent
commit
c87df54f24
  1. 6
      src/frontend/variable.c
  2. 1
      src/include/ngspice/cpextern.h

6
src/frontend/variable.c

@ -789,9 +789,7 @@ cp_getvar(char *name, enum cp_types type, void *retval, size_t rsize)
* isset is TRUE if the variable is being set, FALSE if unset. Also
* required is a routine cp_enqvar(name) which returns a struct
* variable *, which allows the host program to provide values for
* non-cshpar variables. */
char cp_dol = '$';
* non-cshpar variables. See line 855 */
/* Non-alphanumeric characters that may appear in variable names. < is very
* special...
@ -852,7 +850,7 @@ wordlist *cp_variablesubst(wordlist *wlist)
char *s_dollar;
int i = 0;
while ((s_dollar = strchr(wl->wl_word + i, cp_dol)) != NULL) {
while ((s_dollar = strchr(wl->wl_word + i, '$')) != NULL) {
int prefix_len = (int) (s_dollar - wl->wl_word);

1
src/include/ngspice/cpextern.h

@ -156,7 +156,6 @@ extern bool cp_ignoreeof;
extern bool cp_noclobber;
extern bool cp_noglob;
extern bool cp_nonomatch;
extern char cp_dol;
extern void cp_remvar(char *varname);
void cp_vset(const char *varname, enum cp_types type, const void *value);
extern struct variable *cp_setparse(wordlist *wl);

Loading…
Cancel
Save