From 62c6626254322b4215b782e080161aa75ca9c646 Mon Sep 17 00:00:00 2001 From: rlar Date: Sun, 11 Jul 2010 19:34:15 +0000 Subject: [PATCH] add casts for void* returning functions --- ChangeLog | 6 ++++++ src/frontend/numparam/spicenum.c | 12 ++++++------ src/frontend/numparam/xpressn.c | 10 +++++----- src/misc/hash.c | 16 ++++++++-------- 4 files changed, 25 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index c425fe766..e23f20382 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-07-11 Robert Larice + * src/frontend/numparam/spicenum.c , + * src/frontend/numparam/xpressn.c , + * src/misc/hash.c : + add casts for void* returning functions + 2010-07-11 Robert Larice * src/xspice/cmpp/mod_lex.l : for c++, lex input() function is named yyinput() diff --git a/src/frontend/numparam/spicenum.c b/src/frontend/numparam/spicenum.c index b02c6a8e3..299c5441a 100644 --- a/src/frontend/numparam/spicenum.c +++ b/src/frontend/numparam/spicenum.c @@ -552,9 +552,9 @@ dump_symbol_table( tdico *dico_p, NGHASHPTR htable_p, FILE * cp_out) NGHASHITER iter ; /* hash iterator - thread safe */ NGHASH_FIRST(&iter) ; - for (entry_p = nghash_enumerateRE( htable_p,&iter) ; + for (entry_p = (entry *) nghash_enumerateRE( htable_p,&iter) ; entry_p ; - entry_p = nghash_enumerateRE( htable_p,&iter)) + entry_p = (entry *) nghash_enumerateRE( htable_p,&iter)) { if (entry_p->tp == 'R') { @@ -628,7 +628,7 @@ nupa_get_param (char *param_name, int *found) for( depth = dico_p->stack_depth ; depth > 0 ; depth-- ){ htable_p = dico_p->local_symbols[depth] ; if( htable_p ){ - entry_p = nghash_find( htable_p, up_name ) ; + entry_p = (entry *) nghash_find( htable_p, up_name ) ; if( entry_p ){ result = entry_p->vl ; *found = 1; @@ -639,7 +639,7 @@ nupa_get_param (char *param_name, int *found) if(!(*found)){ /* No luck. Try the global table. */ - entry_p = nghash_find( dico_p->global_symbols, up_name ) ; + entry_p = (entry *) nghash_find( dico_p->global_symbols, up_name ) ; if( entry_p ){ result = entry_p->vl ; *found = 1; @@ -733,9 +733,9 @@ nupa_copy_inst_dico (void) fprintf( stderr, "stack depth should be zero.\n" ) ; } NGHASH_FIRST(&iter) ; - for (entry_p = nghash_enumerateRE(dico_p->inst_symbols,&iter ) ; + for (entry_p = (entry *) nghash_enumerateRE(dico_p->inst_symbols,&iter ) ; entry_p ; - entry_p = nghash_enumerateRE(dico_p->inst_symbols,&iter)){ + entry_p = (entry *) nghash_enumerateRE(dico_p->inst_symbols,&iter)){ nupa_add_param ( entry_p->symbol, entry_p->vl) ; dico_free_entry( entry_p ) ; } diff --git a/src/frontend/numparam/xpressn.c b/src/frontend/numparam/xpressn.c index e203678e2..12eda60da 100644 --- a/src/frontend/numparam/xpressn.c +++ b/src/frontend/numparam/xpressn.c @@ -266,9 +266,9 @@ dicostack (tdico * dico, char op) spice_dstring_init(¶m_name) ; NGHASH_FIRST(&iter) ; - for (entry_p = nghash_enumerateRE( htable_p,&iter ) ; + for (entry_p = (entry *) nghash_enumerateRE( htable_p,&iter ) ; entry_p ; - entry_p = nghash_enumerateRE( htable_p,&iter)) + entry_p = (entry *) nghash_enumerateRE( htable_p,&iter)) { spice_dstring_reinit(¶m_name) ; param_p = spice_dstring_print( ¶m_name, "%s.%s", @@ -316,14 +316,14 @@ entrynb ( tdico *d, char *s) for( depth = d->stack_depth ; depth > 0 ; depth-- ){ htable_p = d->local_symbols[depth] ; if( htable_p ){ - entry_p = nghash_find( htable_p, s ) ; + entry_p = (entry *) nghash_find( htable_p, s ) ; if( entry_p ){ return( entry_p ) ; } } } /* No local symbols - try the global table */ - entry_p = nghash_find( d->global_symbols, s ) ; + entry_p = (entry *) nghash_find( d->global_symbols, s ) ; return( entry_p ) ; } /* end entrynb() */ @@ -390,7 +390,7 @@ attrib (tdico *dico_p, NGHASHPTR htable_p, char *t, char op) */ entry *entry_p ; /* symbol table entry */ - entry_p = nghash_find( htable_p, t ) ; + entry_p = (entry *) nghash_find( htable_p, t ) ; if ( entry_p && (op == 'N') && ( entry_p->level < dico_p->stack_depth) && ( entry_p->tp != '?')) { diff --git a/src/misc/hash.c b/src/misc/hash.c index 9b6205fa9..c8f301797 100644 --- a/src/misc/hash.c +++ b/src/misc/hash.c @@ -261,9 +261,9 @@ void * _nghash_find(NGHASHPTR hashtable, void * user_key,BOOL *status) /* list started at this hash */ for( ; curPtr ; curPtr=curPtr->next ) { if( hashtable->compare_func == (void *) NGHASH_DEF_CMP_STR ) { - ret_code = strcmp((char *)curPtr->key, user_key ) ; + ret_code = strcmp((char *)curPtr->key, (char *) user_key ) ; } else if ( hashtable->compare_func == (void *) NGHASH_DEF_CMP_PTR|| - hashtable->compare_func == (void *) NGHASH_DEF_CMP_NUM ){ + hashtable->compare_func == (void *) NGHASH_DEF_CMP_NUM ){ ret_code = NGHASH_PTR_COMPARE_FUNC( curPtr->key, user_key ); } else { compare_func = (COMPARE_FUNC) hashtable->compare_func ; @@ -313,7 +313,7 @@ void * _nghash_find_again(NGHASHPTR hashtable, void * user_key,BOOL *status) if( hashtable->searchPtr ){ for(curPtr=hashtable->searchPtr->next; curPtr ; curPtr=curPtr->next ) { if( hashtable->compare_func == (void *) NGHASH_DEF_CMP_STR ) { - ret_code = strcmp((char *)curPtr->key, user_key ) ; + ret_code = strcmp((char *)curPtr->key, (char *) user_key ) ; } else if ( hashtable->compare_func == (void *) NGHASH_DEF_CMP_PTR|| hashtable->compare_func == (void *) NGHASH_DEF_CMP_NUM ){ ret_code = NGHASH_PTR_COMPARE_FUNC( curPtr->key, user_key ); @@ -381,7 +381,7 @@ void * nghash_delete(NGHASHPTR hashtable, void * user_key) prevPtr = table + hsum ; for( ; curPtr ; prevPtr = &(curPtr->next), curPtr=curPtr->next ) { if( hashtable->compare_func == (void *) NGHASH_DEF_CMP_STR ) { - ret_code = strcmp((char *)curPtr->key, user_key ) ; + ret_code = strcmp((char *)curPtr->key, (char *) user_key ) ; } else if ( hashtable->compare_func == (void *) NGHASH_DEF_CMP_PTR|| hashtable->compare_func == (void *) NGHASH_DEF_CMP_NUM ){ ret_code = NGHASH_PTR_COMPARE_FUNC( curPtr->key, user_key ); @@ -454,7 +454,7 @@ void * nghash_insert(NGHASHPTR hashtable, void * user_key, void * data) for( curPtr = temptr ; curPtr ; curPtr=curPtr->next ) { DS(hashtable->collision++;) ; if( hashtable->compare_func == (void *) NGHASH_DEF_CMP_STR ) { - ret_code = strcmp((char *)curPtr->key, user_key ) ; + ret_code = strcmp((char *)curPtr->key, (char *) user_key ) ; } else if ( hashtable->compare_func == (void *) NGHASH_DEF_CMP_PTR|| hashtable->compare_func == (void *) NGHASH_DEF_CMP_NUM ){ ret_code = NGHASH_PTR_COMPARE_FUNC( curPtr->key, user_key ); @@ -482,7 +482,7 @@ void * nghash_insert(NGHASHPTR hashtable, void * user_key, void * data) table[hsum] = curTable = NGMALLOC(1,NGTABLEBOX); curTable->data = data ; if( hashtable->hash_func == (void *) NGHASH_DEF_HASH_STR ){ - curTable->key = copy( user_key); + curTable->key = copy((char *) user_key); } else { curTable->key = user_key ; } @@ -544,7 +544,7 @@ static NGTABLEPTR _nghash_find_item(NGHASHPTR htable,void * user_key,void * data /* list started at this hash */ for(curPtr=temptr ; curPtr ; curPtr=curPtr->next ) { if( htable->compare_func == (void *) NGHASH_DEF_CMP_STR ) { - ret_code = strcmp((char *)curPtr->key, user_key ) ; + ret_code = strcmp((char *)curPtr->key, (char *) user_key ) ; } else if ( htable->compare_func == (void *) NGHASH_DEF_CMP_PTR|| htable->compare_func == (void *) NGHASH_DEF_CMP_NUM ){ ret_code = NGHASH_PTR_COMPARE_FUNC( curPtr->key, user_key ); @@ -786,7 +786,7 @@ BOOL nghash_deleteItem(NGHASHPTR hashtable, void * user_key, void * data) * Look for match. ----------------------------------------------------------------- */ if( hashtable->compare_func == (void *) NGHASH_DEF_CMP_STR ) { - ret_code = strcmp((char *)curPtr->key, user_key ) ; + ret_code = strcmp((char *)curPtr->key, (char *) user_key ) ; } else if ( hashtable->compare_func == (void *) NGHASH_DEF_CMP_PTR|| hashtable->compare_func == (void *) NGHASH_DEF_CMP_NUM ){ ret_code = NGHASH_PTR_COMPARE_FUNC( curPtr->key, user_key );