X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Ftransformations.c;h=700ed85e40c6285963716857931e597665d6fcfb;hb=cfe28ef151771c04be56d459c58d818f6c43f5e1;hp=7f8672805f1983879934dff1fe0bbaf3996a7381;hpb=ff5e81803b409939e921211f1ffd46cb24df33e9;p=pspp diff --git a/src/data/transformations.c b/src/data/transformations.c index 7f8672805f..700ed85e40 100644 --- a/src/data/transformations.c +++ b/src/data/transformations.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006, 2009, 2011, 2013 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2009, 2011, 2013, 2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,6 +22,7 @@ #include #include "libpspp/str.h" +#include "data/control-stack.h" /* XXX layering violation */ #include "gl/xalloc.h" @@ -32,7 +33,6 @@ struct transformation transformation index. Normally 0 but set to the starting index of a spliced chain after splicing. */ int idx_ofs; - trns_finalize_func *finalize; /* Finalize proc. */ trns_proc_func *execute; /* Executes the transformation. */ trns_free_func *free; /* Garbage collector proc. */ void *aux; /* Auxiliary data. */ @@ -66,18 +66,8 @@ trns_chain_finalize (struct trns_chain *chain) { while (!chain->finalized) { - size_t i; - + ctl_stack_clear (); /* XXX layering violation */ chain->finalized = true; - for (i = 0; i < chain->trns_cnt; i++) - { - struct transformation *trns = &chain->trns[i]; - trns_finalize_func *finalize = trns->finalize; - - trns->finalize = NULL; - if (finalize != NULL) - finalize (trns->aux); - } } } @@ -116,13 +106,11 @@ trns_chain_is_empty (const struct trns_chain *chain) return chain->trns_cnt == 0; } -/* Adds a transformation to CHAIN with finalize function - FINALIZE, execute function EXECUTE, free function FREE, and - auxiliary data AUX. */ +/* Adds a transformation to CHAIN with execute function EXECUTE, free function + FREE, and auxiliary data AUX. */ void -trns_chain_append (struct trns_chain *chain, trns_finalize_func *finalize, - trns_proc_func *execute, trns_free_func *free, - void *aux) +trns_chain_append (struct trns_chain *chain, trns_proc_func *execute, + trns_free_func *free, void *aux) { struct transformation *trns; @@ -134,7 +122,6 @@ trns_chain_append (struct trns_chain *chain, trns_finalize_func *finalize, trns = &chain->trns[chain->trns_cnt++]; trns->idx_ofs = 0; - trns->finalize = finalize; trns->execute = execute; trns->free = free; trns->aux = aux; @@ -166,6 +153,7 @@ trns_chain_splice (struct trns_chain *dst, struct trns_chain *src) } dst->trns_cnt += src->trns_cnt; + src->trns_cnt = 0; trns_chain_destroy (src); }