X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=vector%2FView.c;h=5b3179a9738d0ec8bea182c1a84695790b20dfba;hb=08d34592f06a37ece6c8a4715e8efdcfa61849d2;hp=5da2bcc0719a466c3d754e099ace0e66826ba9cc;hpb=813cf9d12ff1b1c58e508485c977d33caaf89a86;p=rrq%2Frrqmisc.git diff --git a/vector/View.c b/vector/View.c index 5da2bcc..5b3179a 100644 --- a/vector/View.c +++ b/vector/View.c @@ -27,7 +27,7 @@ typedef struct { * This is the collection of bindings for the tracked names being * gained at the latest evaluation. */ - HashVector gained; + Vector gained; /** * This is the collection of bindings for the tracked names being * last at the latest evaluation. @@ -39,13 +39,23 @@ static Tuple *View_type_Tuple(HashVector *hv) { Tuple *t = Tuple_calloc( hv->fill ); VectorIndex index = 0; for ( ; index < hv->table.size; index++ ) { - t->elements[ index ] = &stringitem; + t->elements[ index ] = HashVector_next( hv, &index ); } return t; } +static void View_reclaim(Query *this) { + View *v = (View*) this; + TupleSchema *ts = (TupleSchema*) gained->type; + Vector_resize( &v->gained, 0, Vector_clear_any, 0 ); + Vector_resize( &v->lost, 0, Vector_clear_any, 0 ); + free( ts->columns ); + free( ts ); + free( this ); +} + static QueryCallbacks View_def = { - .reclaim = 0, + .reclaim = View_reclaim, .next = 0, .variables = 0 }; @@ -82,5 +92,6 @@ Query *View_create(Query *q) { .fill = 0, .holes = 0, .type = (ItemKeyFun*) ts } }; + Vector_resize( &hv, 0, Vector_clear_any, 0 ); return (Query*) vq; }