From e3ea250a4decf83f7e552b25fef5167dffe71583 Mon Sep 17 00:00:00 2001 From: rlar Date: Sat, 6 Nov 2010 17:22:06 +0000 Subject: [PATCH] tiny rewrite, don't invoke strlen() to check for strlen() == 1 --- ChangeLog | 5 +++++ src/spicelib/parser/inp2dot.c | 4 +--- src/spicelib/parser/inppas3.c | 7 ++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index ef168a5c4..f5354e11f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-11-06 Robert Larice + * src/spicelib/parser/inp2dot.c , + * src/spicelib/parser/inppas3.c : + tiny rewrite, don't invoke strlen() to check for strlen() == 1 + 2010-11-06 Robert Larice * src/xspice/idn/idndig.c : change a (int) cast application, to avoid type conversion warnings diff --git a/src/spicelib/parser/inp2dot.c b/src/spicelib/parser/inp2dot.c index 964829f71..cae888e7d 100644 --- a/src/spicelib/parser/inp2dot.c +++ b/src/spicelib/parser/inp2dot.c @@ -52,10 +52,8 @@ dot_noise(char *line, CKTcircuit *ckt, INPtables *tab, card *current, is, extract 'xxxx'. If not, report an error. */ if (name != NULL) { - int length; - length = strlen(name); - if (((*name == 'V') || (*name == 'v')) && (length == 1)) { + if ((*name == 'V' || *name == 'v') && !name[1]) { INPgetNetTok(&line, &nname1, 0); INPtermInsert(ckt, &nname1, tab, &node1); diff --git a/src/spicelib/parser/inppas3.c b/src/spicelib/parser/inppas3.c index 349369db9..877edd106 100644 --- a/src/spicelib/parser/inppas3.c +++ b/src/spicelib/parser/inppas3.c @@ -36,7 +36,6 @@ INPpas3(CKTcircuit *ckt, card *data, INPtables *tab, TSKtask *task, IFvalue ptemp; /* a value structure to package resistance into */ int which; /* which analysis we are performing */ - int length; /* length of a name */ CKTnode *node1; /* the first node's node pointer */ #ifdef TRACE @@ -70,8 +69,7 @@ INPpas3(CKTcircuit *ckt, card *data, INPtables *tab, TSKtask *task, /* check to see if in the form V(xxx) and grab the xxx */ if( *name == 0) break; /* end of line */ - length = strlen(name); - if( (*name == 'V' || *(name) == 'v') && (length == 1)){ + if( (*name == 'V' || *name == 'v') && !name[1] ) { /* looks like V - must be V(xx) - get xx now*/ INPgetTok(&line,&name,1); if (INPtermInsert(ckt,&name,tab,&node1)!=E_EXISTS) @@ -104,8 +102,7 @@ INPpas3(CKTcircuit *ckt, card *data, INPtables *tab, TSKtask *task, INPgetTok(&line,&name,1); /* check to see if in the form V(xxx) and grab the xxx */ if( *name == 0) break; /* end of line */ - length = strlen(name); - if( (*name == 'V' || *(name) == 'v') && (length == 1)){ + if( (*name == 'V' || *name == 'v') && !name[1] ) { /* looks like V - must be V(xx) - get xx now*/ INPgetTok(&line,&name,1); if (INPtermInsert(ckt,&name,tab,&node1)!=E_EXISTS)