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)
This commit is contained in:
Holger Vogt 2023-11-11 10:39:51 +01:00
parent 02aa2c03f9
commit c87df54f24
2 changed files with 2 additions and 5 deletions

View File

@ -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);

View File

@ -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);