Skip to content

Commit e165c2a

Browse files
committed
eliminate unnecessary variable, formatting
1 parent 25162d1 commit e165c2a

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

src/clstepcore/STEPattributeList.cc

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@ STEPattribute & STEPattributeList::operator []( int n ) {
3232
int x = 0;
3333
AttrListNode * a = ( AttrListNode * )head;
3434
int cnt = EntryCount();
35-
if( n < cnt )
35+
if( n < cnt ) {
3636
while( a && ( x < n ) ) {
3737
a = ( AttrListNode * )( a->next );
3838
x++;
3939
}
40+
}
4041
if( a ) {
4142
return *( a->attr );
4243
}
@@ -52,22 +53,16 @@ int STEPattributeList::list_length() {
5253
}
5354

5455
void STEPattributeList::push( STEPattribute * a ) {
55-
bool push = true;
56-
57-
// if the attribute already exists in the list, we don't push it
58-
// TODO: does it break anything?
5956
AttrListNode * a2 = ( AttrListNode * )head;
60-
while( a2 && push ) {
57+
58+
// if the attribute already exists in the list, don't push it
59+
while( a2 ) {
6160
if( *a == *( a2 -> attr ) ) {
62-
push = false;
63-
break;
61+
return;
6462
}
6563
a2 = ( AttrListNode * )( a2->next );
6664
}
67-
68-
if( push ) {
69-
a->refCount ++;
70-
AttrListNode * saln = new AttrListNode( a );
71-
AppendNode( saln );
72-
}
65+
a->refCount ++;
66+
AttrListNode * saln = new AttrListNode( a );
67+
AppendNode( saln );
7368
}

0 commit comments

Comments
 (0)