numparam/*, use `pscopy()'

This commit is contained in:
rlar 2017-12-27 23:58:31 +01:00
parent 9ad63cc2c0
commit 95ef5e79d9
2 changed files with 11 additions and 9 deletions

View File

@ -185,9 +185,10 @@ findsubname(dico_t *dico, SPICE_DSTRINGPTR dstr_p)
char *t; char *t;
entry_t *entry; entry_t *entry;
/* check for known subckt name */ /* check for known subckt name */
spice_dstring_reinit(&name);
for (t = p; alfanum(*t); t++) for (t = p; alfanum(*t); t++)
cadd(&name, *t); ;
spice_dstring_reinit(&name);
pscopy(&name, p, t);
entry = entrynb(dico, spice_dstring_value(&name)); entry = entrynb(dico, spice_dstring_value(&name));
if (entry && (entry->tp == NUPA_SUBCKT)) { if (entry && (entry->tp == NUPA_SUBCKT)) {
spice_dstring_setlength(dstr_p, (int) (p_end - s)); spice_dstring_setlength(dstr_p, (int) (p_end - s));

View File

@ -954,8 +954,7 @@ formula(dico_t *dico, const char *s, const char *s_end, bool *perror)
state = S_init; /* S_init means: ignore for the moment */ state = S_init; /* S_init means: ignore for the moment */
} else { } else {
spice_dstring_reinit(&tstr); spice_dstring_reinit(&tstr);
while (s < s_next) pscopy(&tstr, s, s_next);
cadd(&tstr, *s++);
u = fetchnumentry(dico, spice_dstring_value(&tstr), &error); u = fetchnumentry(dico, spice_dstring_value(&tstr), &error);
state = S_atom; state = S_atom;
} }
@ -1206,14 +1205,17 @@ static const char *
getword(const char *s, SPICE_DSTRINGPTR tstr_p) getword(const char *s, SPICE_DSTRINGPTR tstr_p)
{ {
const char *s_end = s + strlen(s); const char *s_end = s + strlen(s);
const char *word;
while ((s < s_end - 1) && !alfa(*s)) while ((s < s_end - 1) && !alfa(*s))
s++; s++;
spice_dstring_reinit(tstr_p); word = s;
while (alfa(*s) || isdigit_c(*s))
s++;
while ((s < s_end) && (alfa(*s) || isdigit_c(*s))) spice_dstring_reinit(tstr_p);
cadd(tstr_p, *s++); pscopy(tstr_p, word, s);
return s; return s;
} }
@ -1431,8 +1433,7 @@ nupa_subcktcall(dico_t *dico, char *s, char * const x, char * const inst_name)
const char *j2 = strstr(spice_dstring_value(&tstr), "subckt"); const char *j2 = strstr(spice_dstring_value(&tstr), "subckt");
if (j2) { if (j2) {
j2 = skip_ws(j2 + 6); /* skip subckt and whitespace */ j2 = skip_ws(j2 + 6); /* skip subckt and whitespace */
while (*j2 && (*j2 != ' ')) pscopy(&subname, j2, skip_non_ws(j2));
cadd(&subname, *j2++);
} else { } else {
err = message(dico, " ! a subckt line!\n"); err = message(dico, " ! a subckt line!\n");
} }