defsubckt(), i ==> i_ptr - (const) s
This commit is contained in:
parent
deca1a05ed
commit
6d285d927a
|
|
@ -511,29 +511,30 @@ defsubckt(dico_t *dico, struct card *card, nupa_type categ)
|
||||||
int w = card->linenum;
|
int w = card->linenum;
|
||||||
|
|
||||||
bool err;
|
bool err;
|
||||||
int i, j;
|
int j;
|
||||||
|
|
||||||
const char * const ls_ptr = s + strlen(s);
|
const char * const ls_ptr = s + strlen(s);
|
||||||
i = 0;
|
const char *i_ptr;
|
||||||
|
(i_ptr - s) = 0;
|
||||||
|
|
||||||
while ((i < (ls_ptr - s)) && (s[i] != '.'))
|
while (((i_ptr - s) < (ls_ptr - s)) && (s[(i_ptr - s)] != '.'))
|
||||||
i++; /* skip 1st dotword */
|
(i_ptr - s)++; /* skip 1st dotword */
|
||||||
|
|
||||||
while ((i < (ls_ptr - s)) && (s[i] > ' '))
|
while (((i_ptr - s) < (ls_ptr - s)) && (s[(i_ptr - s)] > ' '))
|
||||||
i++;
|
(i_ptr - s)++;
|
||||||
|
|
||||||
while ((i < (ls_ptr - s)) && (s[i] <= ' '))
|
while (((i_ptr - s) < (ls_ptr - s)) && (s[(i_ptr - s)] <= ' '))
|
||||||
i++; /* skip blank */
|
(i_ptr - s)++; /* skip blank */
|
||||||
|
|
||||||
j = i;
|
j = (int) (i_ptr - s);
|
||||||
|
|
||||||
while ((j < (ls_ptr - s)) && (s[j] > ' '))
|
while ((j < (ls_ptr - s)) && (s[j] > ' '))
|
||||||
j++;
|
j++;
|
||||||
|
|
||||||
if (j > i) {
|
if (j > (i_ptr - s)) {
|
||||||
SPICE_DSTRING ustr; /* temp user string */
|
SPICE_DSTRING ustr; /* temp user string */
|
||||||
spice_dstring_init(&ustr);
|
spice_dstring_init(&ustr);
|
||||||
pscopy_up(&ustr, s, i, j - i);
|
pscopy_up(&ustr, s, (int) (i_ptr - s), j - (int) (i_ptr - s));
|
||||||
err = nupa_define(dico, spice_dstring_value(&ustr), ' ', categ, 0.0, w, NULL);
|
err = nupa_define(dico, spice_dstring_value(&ustr), ' ', categ, 0.0, w, NULL);
|
||||||
spice_dstring_free(&ustr);
|
spice_dstring_free(&ustr);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue