* src/main.c (main): Use a separate variable to track final character.
* src/read.c (eval): Track the semicolon position not one beyond it.
* src/variable.c (do_variable_definition): Include a default switch
case to ease the work of the exhaustiveness prover.
if (eval_strings)
{
- char *p, *value;
+ char *p, *endp, *value;
unsigned int i;
size_t len = (CSTRLEN ("--eval=") + 1) * eval_strings->idx;
free (p);
}
- p = value = alloca (len);
+ p = endp = value = alloca (len);
for (i = 0; i < eval_strings->idx; ++i)
{
strcpy (p, "--eval=");
p += CSTRLEN ("--eval=");
p = quote_for_env (p, eval_strings->list[i]);
- *(p++) = ' ';
+ endp = p++;
+ *endp = ' ';
}
- p[-1] = '\0';
+ *endp = '\0';
define_variable_cname ("-*-eval-flags-*-", value, o_automatic, 0);
}
{
enum make_word_type wtype;
- char *cmdleft, *semip, *lb_next;
+ char *cmdleft, *semip = 0, *lb_next;
size_t plen = 0;
char *colonp;
const char *end, *beg; /* Helpers for whitespace stripping. */
cmdleft = 0;
}
else if (cmdleft != 0)
- /* Found one. Cut the line short there before expanding it. */
- *(cmdleft++) = '\0';
- semip = cmdleft;
+ {
+ /* Found one. Cut the line short there before expanding it. */
+ semip = cmdleft++;
+ *semip = '\0';
+ }
collapse_continuations (line);
if (semip)
{
size_t l = p2 - variable_buffer;
- *(--semip) = ';';
+ *semip = ';';
collapse_continuations (semip);
variable_buffer_output (p2 + strlen (p2),
semip, strlen (semip)+1);
switch (flavor)
{
- case f_bogus:
- /* Should not be possible. */
- abort ();
case f_simple:
/* A simple variable definition "var := value". Expand the value.
We have to allocate memory since otherwise it'll clobber the
free (tp);
}
- break;
}
+ break;
+ case f_bogus:
+ default:
+ /* Should not be possible. */
+ abort ();
}
#ifdef __MSDOS__