cleanup `skip_ws()' usage
This commit is contained in:
parent
b1d8b99018
commit
5e04924890
|
|
@ -112,8 +112,7 @@ com_let(wordlist *wl)
|
|||
vec_free(t);
|
||||
free_pnode(names); /* frees also t, if pnode `names' is simple value */
|
||||
|
||||
s = q;
|
||||
s = skip_ws(s);
|
||||
s = skip_ws(q);
|
||||
}
|
||||
}
|
||||
/* vector name at p */
|
||||
|
|
|
|||
|
|
@ -136,8 +136,7 @@ atodims(char *p, int *data, int *outlength)
|
|||
p = skip_ws(p);
|
||||
|
||||
if (*p == '[') {
|
||||
p++;
|
||||
p = skip_ws(p);
|
||||
p = skip_ws(p + 1);
|
||||
needbracket = 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -73,8 +73,7 @@ hlp_thandle(topic **parent)
|
|||
return (NULL);
|
||||
}
|
||||
|
||||
s = buf;
|
||||
s = skip_ws(s);
|
||||
s = skip_ws(buf);
|
||||
switch (*s) {
|
||||
case '?':
|
||||
fprintf(cp_out,
|
||||
|
|
|
|||
|
|
@ -395,16 +395,14 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
|
|||
for (dd = deck->li_next; dd; dd = ld->li_next) {
|
||||
/* get temp from deck */
|
||||
if (ciprefix(".temp", dd->li_line)) {
|
||||
s = dd->li_line + 5;
|
||||
s = skip_ws(s);
|
||||
s = skip_ws(dd->li_line + 5);
|
||||
if (temperature)
|
||||
txfree(temperature);
|
||||
temperature = strdup(s);
|
||||
}
|
||||
/* Ignore comment lines, but not lines begining with '*#',
|
||||
but remove them, if they are in a .control ... .endc section */
|
||||
s = dd->li_line;
|
||||
s = skip_ws(s);
|
||||
s = skip_ws(dd->li_line);
|
||||
if ((*s == '*') && ((s != dd->li_line) || (s[1] != '#'))) {
|
||||
if (commands) {
|
||||
/* Remove comment lines in control sections, so they don't
|
||||
|
|
@ -419,10 +417,8 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
|
|||
|
||||
/* Put the first token from line into s */
|
||||
strncpy(name, dd->li_line, BSIZE_SP);
|
||||
s = name;
|
||||
s = skip_ws(s);
|
||||
t = s;
|
||||
t = skip_non_ws(t);
|
||||
s = skip_ws(name);
|
||||
t = skip_non_ws(s);
|
||||
*t = '\0';
|
||||
|
||||
if (ciprefix(".control", dd->li_line)) {
|
||||
|
|
@ -563,10 +559,8 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
|
|||
wordlist *wlist = NULL;
|
||||
char *cstoken[3];
|
||||
int i;
|
||||
s = dd->li_line;
|
||||
*s = '*';
|
||||
s = dd->li_line + 8;
|
||||
s = skip_ws(s);
|
||||
dd->li_line[0] = '*';
|
||||
s = skip_ws(dd->li_line + 8);
|
||||
cstoken[0] = gettok_char(&s, '=', FALSE, FALSE);
|
||||
cstoken[1] = gettok_char(&s, '=', TRUE, FALSE);
|
||||
cstoken[2] = gettok(&s);
|
||||
|
|
@ -805,8 +799,7 @@ inp_dodeck(
|
|||
if (!noparse) {
|
||||
struct line *opt_beg = options;
|
||||
for (; options; options = options->li_next) {
|
||||
s = options->li_line;
|
||||
s = skip_non_ws(s);
|
||||
s = skip_non_ws(options->li_line);
|
||||
|
||||
ii = cp_interactive;
|
||||
cp_interactive = FALSE;
|
||||
|
|
@ -986,8 +979,7 @@ inp_dodeck(
|
|||
if (!noparse) {
|
||||
/*
|
||||
* for (; options; options = options->li_next) {
|
||||
* s = options->li_line;
|
||||
* s = skip_non_ws(s);
|
||||
* s = skip_non_ws(options->li_line);
|
||||
* ii = cp_interactive;
|
||||
* cp_interactive = FALSE;
|
||||
* wl = cp_lexer(s);
|
||||
|
|
|
|||
|
|
@ -831,8 +831,7 @@ nupa_eval(char *s, int linenum, int orig_linenum)
|
|||
err = nupa_substitute(dicoS, dicoS->dynrefptr[linenum], s, 0);
|
||||
} else if (c == 'X') {
|
||||
/* compute args of subcircuit, if required */
|
||||
ptr = s;
|
||||
ptr = skip_non_ws(ptr);
|
||||
ptr = skip_non_ws(s);
|
||||
keep = *ptr;
|
||||
*ptr = '\0';
|
||||
nupa_inst_name = strdup(s);
|
||||
|
|
|
|||
|
|
@ -94,10 +94,8 @@ inp_nutsource(FILE *fp, bool comfile, char *filename)
|
|||
continue;
|
||||
}
|
||||
(void) strncpy(name, dd->li_line, BSIZE_SP);
|
||||
s = name;
|
||||
s = skip_ws(s);
|
||||
t = s;
|
||||
t = skip_non_ws(t);
|
||||
s = skip_ws(name);
|
||||
t = skip_non_ws(s);
|
||||
*t = '\0';
|
||||
|
||||
if (ciprefix(".control", dd->li_line)) {
|
||||
|
|
|
|||
|
|
@ -152,10 +152,9 @@ collect_global_nodes(struct line *c)
|
|||
char *s = c->li_line;
|
||||
txfree(gettok(&s));
|
||||
while (*s) {
|
||||
char *t = s;
|
||||
s = skip_non_ws(s);
|
||||
global_nodes[num_global_nodes++] = copy_substring(t, s);
|
||||
s = skip_ws(s);
|
||||
char *t = skip_non_ws(s);
|
||||
global_nodes[num_global_nodes++] = copy_substring(s, t);
|
||||
s = skip_ws(t);
|
||||
}
|
||||
c->li_line[0] = '*'; /* comment it out */
|
||||
}
|
||||
|
|
@ -1309,8 +1308,7 @@ finishLine(struct bxx_buffer *t, char *src, char *scname)
|
|||
bxx_putc(t, *src++);
|
||||
continue;
|
||||
}
|
||||
s = src + 1;
|
||||
s = skip_ws(s);
|
||||
s = skip_ws(src + 1);
|
||||
if (!*s || (*s != '(')) {
|
||||
lastwasalpha = isalpha_c(*src);
|
||||
bxx_putc(t, *src++);
|
||||
|
|
|
|||
|
|
@ -938,9 +938,7 @@ vec_basename(struct dvec *v)
|
|||
}
|
||||
|
||||
strtolower(buf);
|
||||
t = buf;
|
||||
t = skip_ws(t);
|
||||
s = t;
|
||||
s = skip_ws(buf);
|
||||
for (t = s; *t; t++)
|
||||
;
|
||||
while ((t > s) && isspace_c(t[-1]))
|
||||
|
|
|
|||
|
|
@ -663,8 +663,7 @@ get_comma_separated_values( char *values[], char *str ) {
|
|||
ptr++; keep = *ptr; *ptr = '\0';
|
||||
values[count++] = strdup(str);
|
||||
*ptr = keep;
|
||||
str = comma_ptr + 1;
|
||||
str = skip_ws(str);
|
||||
str = skip_ws(comma_ptr + 1);
|
||||
}
|
||||
values[count++] = strdup(str);
|
||||
return count;
|
||||
|
|
|
|||
|
|
@ -83,19 +83,13 @@ void INP2R(CKTcircuit *ckt, INPtables * tab, card * current)
|
|||
char *p;
|
||||
size_t left_length;
|
||||
|
||||
s += 2;
|
||||
|
||||
/* skip any white space */
|
||||
s = skip_ws(s);
|
||||
s = skip_ws(s + 2);
|
||||
|
||||
/* reject if not '=' */
|
||||
if(*s != '=')
|
||||
continue;
|
||||
|
||||
s++;
|
||||
|
||||
/* skip any white space */
|
||||
s = skip_ws(s);
|
||||
s = skip_ws(s + 1);
|
||||
|
||||
/* if we now have +, - or a decimal digit then assume we have a number,
|
||||
otherwise reject */
|
||||
|
|
|
|||
Loading…
Reference in New Issue