void var_set( char *symbol, LIST *value, int flag ) { VARIABLE *v = var_enter( symbol ); if( DEBUG_VARSET ) var_dump( symbol, value, "set" ); switch( flag ) { case VAR_SET: /* Replace value */ list_free( v->value ); v->value = value; break; case VAR_APPEND: /* Append value */ v->value = list_append( v->value, value ); break; case VAR_DEFAULT: /* Set only if unset */ if( !v->value ) v->value = value; else list_free( value ); break; } }
void var_set( struct module_t * module, OBJECT * symbol, LIST * value, int flag ) { LIST * * v = var_enter( module, symbol ); if ( DEBUG_VARSET ) var_dump( symbol, value, "set" ); switch ( flag ) { case VAR_SET: /* Replace value */ list_free( *v ); *v = value; break; case VAR_APPEND: /* Append value */ *v = list_append( *v, value ); break; case VAR_DEFAULT: /* Set only if unset */ if ( list_empty( *v ) ) *v = value; else list_free( value ); break; } }
LIST * var_swap( struct module_t * module, OBJECT * symbol, LIST * value ) { LIST * * v = var_enter( module, symbol ); LIST * oldvalue = *v; if ( DEBUG_VARSET ) var_dump( symbol, value, "set" ); *v = value; return oldvalue; }
LIST * var_swap( OBJECT * symbol, LIST * value ) { VARIABLE * v = var_enter( symbol ); LIST * oldvalue = v->value; if ( DEBUG_VARSET ) var_dump( symbol, value, "set" ); v->value = value; return oldvalue; }