Skip to content

Commit 4740f4d

Browse files
committed
Added SCL_ prefix to hash functions of scl_hash.cc.
* Linking went wrong because functions from hash.c and scl_hash.cc had the same names. By adding SCL_ prefix to the scl_hash.cc function names this issue is resolved. * Fixed minor issue in scl_hash.cc.
1 parent 04f4c1d commit 4740f4d

3 files changed

Lines changed: 76 additions & 71 deletions

File tree

src/clstepcore/Registry.inline.cc

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,9 @@ static int uniqueNames( const char *, const SchRename * );
2626
Registry::Registry( CF_init initFunct )
2727
: col( 0 ), entity_cnt( 0 ), all_ents_cnt( 0 ) {
2828

29-
/* Registry tables aren't always initialized */
30-
HASHinitialize();
31-
primordialSwamp = HASHcreate( 1000 );
32-
active_schemas = HASHcreate( 10 );
33-
active_types = HASHcreate( 100 );
29+
primordialSwamp = SCL_HASHcreate( 1000 );
30+
active_schemas = SCL_HASHcreate( 10 );
31+
active_types = SCL_HASHcreate( 100 );
3432

3533
t_sdaiINTEGER = new TypeDescriptor( "INTEGER", // Name
3634
sdaiINTEGER, // FundamentalType
@@ -62,34 +60,38 @@ Registry::Registry( CF_init initFunct )
6260
"Number" );
6361

6462
initFunct( *this );
65-
HASHlistinit( active_types, &cur_type );
66-
HASHlistinit( primordialSwamp, &cur_entity ); // initialize cur's
67-
HASHlistinit( active_schemas, &cur_schema );
63+
SCL_HASHlistinit( active_types, &cur_type );
64+
SCL_HASHlistinit( primordialSwamp, &cur_entity ); // initialize cur's
65+
SCL_HASHlistinit( active_schemas, &cur_schema );
6866
}
6967

7068
Registry::~Registry() {
7169
DeleteContents();
72-
HASHdestroy( primordialSwamp );
73-
HASHdestroy( active_schemas );
74-
HASHdestroy( active_types );
70+
71+
SCL_HASHdestroy( primordialSwamp );
72+
SCL_HASHdestroy( active_schemas );
73+
SCL_HASHdestroy( active_types );
7574
delete col;
7675
}
7776

7877
void Registry::DeleteContents() {
7978
// entities first
80-
HASHlistinit( primordialSwamp, &cur_entity );
81-
while( HASHlist( &cur_entity ) ) {
79+
SCL_HASHlistinit( primordialSwamp, &cur_entity );
80+
while( SCL_HASHlist( &cur_entity ) ) {
8281
delete( EntityDescriptor * ) cur_entity.e->data;
8382
}
8483

8584
// schemas
86-
HASHlistinit( active_schemas, &cur_schema );
87-
while( HASHlist( &cur_schema ) ) {
85+
SCL_HASHlistinit( active_schemas, &cur_schema );
86+
while( SCL_HASHlist( &cur_schema ) ) {
8887
delete( Schema * ) cur_schema.e->data;
8988
}
9089

9190
// types
92-
91+
SCL_HASHlistinit( active_types, &cur_type );
92+
while ( SCL_HASHlist( &cur_type ) ) {
93+
delete( TypeDescriptor * ) cur_type.e->data;
94+
}
9395
}
9496

9597
/**
@@ -107,9 +109,9 @@ const EntityDescriptor * Registry::FindEntity( const char * e, const char * schN
107109
char schformat[BUFSIZ], altName[BUFSIZ];
108110

109111
if( check_case ) {
110-
entd = ( EntityDescriptor * )HASHfind( primordialSwamp, ( char * )e );
112+
entd = ( EntityDescriptor * )SCL_HASHfind( primordialSwamp, ( char * )e );
111113
} else {
112-
entd = ( EntityDescriptor * )HASHfind( primordialSwamp,
114+
entd = ( EntityDescriptor * )SCL_HASHfind( primordialSwamp,
113115
( char * )PrettyTmpName( e ) );
114116
}
115117
if( entd && schNm ) {
@@ -143,46 +145,46 @@ const EntityDescriptor * Registry::FindEntity( const char * e, const char * schN
143145

144146
const Schema * Registry::FindSchema( const char * n, int check_case ) const {
145147
if( check_case ) {
146-
return ( const Schema * ) HASHfind( active_schemas, ( char * ) n );
148+
return ( const Schema * ) SCL_HASHfind( active_schemas, ( char * ) n );
147149
}
148150

149-
return ( const Schema * ) HASHfind( active_schemas,
151+
return ( const Schema * ) SCL_HASHfind( active_schemas,
150152
( char * )PrettyTmpName( n ) );
151153
}
152154

153155
const TypeDescriptor * Registry::FindType( const char * n, int check_case ) const {
154156
if( check_case ) {
155-
return ( const TypeDescriptor * ) HASHfind( active_types, ( char * ) n );
157+
return ( const TypeDescriptor * ) SCL_HASHfind( active_types, ( char * ) n );
156158
}
157-
return ( const TypeDescriptor * ) HASHfind( active_types,
159+
return ( const TypeDescriptor * ) SCL_HASHfind( active_types,
158160
( char * )PrettyTmpName( n ) );
159161
}
160162

161163
void Registry::ResetTypes() {
162-
HASHlistinit( active_types, &cur_type );
164+
SCL_HASHlistinit( active_types, &cur_type );
163165
}
164166

165167
const TypeDescriptor * Registry::NextType() {
166-
if( 0 == HASHlist( &cur_type ) ) {
168+
if( 0 == SCL_HASHlist( &cur_type ) ) {
167169
return 0;
168170
}
169171
return ( const TypeDescriptor * ) cur_type.e->data;
170172
}
171173

172174
void Registry::AddEntity( const EntityDescriptor & e ) {
173-
HASHinsert( primordialSwamp, ( char * ) e.Name(), ( EntityDescriptor * ) &e );
175+
SCL_HASHinsert( primordialSwamp, ( char * ) e.Name(), ( EntityDescriptor * ) &e );
174176
++entity_cnt;
175177
++all_ents_cnt;
176178
AddClones( e );
177179
}
178180

179181

180182
void Registry::AddSchema( const Schema & d ) {
181-
HASHinsert( active_schemas, ( char * ) d.Name(), ( Schema * ) &d );
183+
SCL_HASHinsert( active_schemas, ( char * ) d.Name(), ( Schema * ) &d );
182184
}
183185

184186
void Registry::AddType( const TypeDescriptor & d ) {
185-
HASHinsert( active_types, ( char * ) d.Name(), ( TypeDescriptor * ) &d );
187+
SCL_HASHinsert( active_types, ( char * ) d.Name(), ( TypeDescriptor * ) &d );
186188
}
187189

188190
/**
@@ -196,7 +198,7 @@ void Registry::AddClones( const EntityDescriptor & e ) {
196198
const SchRename * alts = e.AltNameList();
197199

198200
while( alts ) {
199-
HASHinsert( primordialSwamp, ( char * )alts->objName(),
201+
SCL_HASHinsert( primordialSwamp, ( char * )alts->objName(),
200202
( EntityDescriptor * )&e );
201203
alts = alts->next;
202204
}
@@ -239,20 +241,20 @@ void Registry::RemoveEntity( const char * n ) {
239241
RemoveClones( *e );
240242
}
241243
tmp.key = ( char * ) n;
242-
HASHsearch( primordialSwamp, &tmp, HASH_DELETE ) ? --entity_cnt : 0;
244+
SCL_HASHsearch( primordialSwamp, &tmp, HASH_DELETE ) ? --entity_cnt : 0;
243245

244246
}
245247

246248
void Registry::RemoveSchema( const char * n ) {
247249
struct Element tmp;
248250
tmp.key = ( char * ) n;
249-
HASHsearch( active_schemas, &tmp, HASH_DELETE );
251+
SCL_HASHsearch( active_schemas, &tmp, HASH_DELETE );
250252
}
251253

252254
void Registry::RemoveType( const char * n ) {
253255
struct Element tmp;
254256
tmp.key = ( char * ) n;
255-
HASHsearch( active_types, &tmp, HASH_DELETE );
257+
SCL_HASHsearch( active_types, &tmp, HASH_DELETE );
256258
}
257259

258260
/**
@@ -265,7 +267,7 @@ void Registry::RemoveClones( const EntityDescriptor & e ) {
265267
while( alts ) {
266268
tmp = new Element;
267269
tmp->key = ( char * ) alts->objName();
268-
HASHsearch( primordialSwamp, tmp, HASH_DELETE );
270+
SCL_HASHsearch( primordialSwamp, tmp, HASH_DELETE );
269271
alts = alts->next;
270272
}
271273
}
@@ -297,23 +299,23 @@ int Registry::GetEntityCnt() {
297299
}
298300

299301
void Registry::ResetEntities() {
300-
HASHlistinit( primordialSwamp, &cur_entity );
302+
SCL_HASHlistinit( primordialSwamp, &cur_entity );
301303

302304
}
303305

304306
const EntityDescriptor * Registry::NextEntity() {
305-
if( 0 == HASHlist( &cur_entity ) ) {
307+
if( 0 == SCL_HASHlist( &cur_entity ) ) {
306308
return 0;
307309
}
308310
return ( const EntityDescriptor * ) cur_entity.e->data;
309311
}
310312

311313
void Registry::ResetSchemas() {
312-
HASHlistinit( active_schemas, &cur_schema );
314+
SCL_HASHlistinit( active_schemas, &cur_schema );
313315
}
314316

315317
const Schema * Registry::NextSchema() {
316-
if( 0 == HASHlist( &cur_schema ) ) {
318+
if( 0 == SCL_HASHlist( &cur_schema ) ) {
317319
return 0;
318320
}
319321
return ( const Schema * ) cur_schema.e->data;

0 commit comments

Comments
 (0)