return 0;
}
-void BindingTable_deref(BindingTable *bt,int arity,tuple *t) {
+void BindingTable_deref(BindingTable *bt,int arity,Tuple *t) {
int i;
for ( i = 0; i < arity; i++ ) {
- if ( (*t)[i] ) {
- (*t)[i] = BindingTable_get( bt, (*t)[i] );
+ if ( t->elements[i] ) {
+ t->elements[i] = BindingTable_get( bt, t->elements[i] );
}
}
}
#define COPYA(T,P,N) (T*) memcpy( malloc( N * sizeof(T) ), P, N * sizeof( T ) )
-tuple *BindingTable_tuple_get(BindingTable *bt,int arity,tuple *t) {
- tuple *vt = (tuple*) memcpy(
- malloc( arity * sizeof( void* ) ), t, arity * sizeof( void* ) );
+Tuple *BindingTable_tuple_get(BindingTable *bt,int arity,Tuple *t) {
+ Tuple *vt = Tuple_clone( arity, t );
BindingTable_deref( bt, arity, vt );
return vt;
}
-void BindingTable_tuple_set(BindingTable *bt,int arity,tuple *nm,tuple *vs) {
+void BindingTable_tuple_set(BindingTable *bt,int arity,Tuple *nm,Tuple *vs) {
int i;
for ( i = 0; i < arity; i++ ) {
- BindingTable_set( bt, (*nm)[i], (*vs)[i] );
+ BindingTable_set( bt, nm->elements[i], vs->elements[i] );
}
}