X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Ftransformations.c;h=f77c24f8b95095a832b416a756ac26fd53a4a13e;hb=0498114186f126d786cc0f3cf6686a43b8513e62;hp=e5542b882e94a4b3d928078c546ef67cc02c6d5f;hpb=b0bf9b1b0f727fafac4296a048e3f45db5936f81;p=pspp-builds.git diff --git a/src/data/transformations.c b/src/data/transformations.c index e5542b88..f77c24f8 100644 --- a/src/data/transformations.c +++ b/src/data/transformations.c @@ -1,6 +1,5 @@ /* PSPP - computes sample statistics. Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc. - Written by Ben Pfaff . This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -25,7 +24,6 @@ #include #include -#include #include "xalloc.h" @@ -106,6 +104,7 @@ trns_chain_destroy (struct trns_chain *chain) if (trns->free != NULL) ok = trns->free (trns->aux) && ok; } + free (chain->trns); free (chain); } @@ -189,13 +188,13 @@ trns_chain_next (struct trns_chain *chain) terminate, or TRNS_CONTINUE if the transformations finished due to "falling off the end" of the set of transformations. */ enum trns_result -trns_chain_execute (struct trns_chain *chain, struct ccase *c, - const size_t *case_nr) +trns_chain_execute (struct trns_chain *chain, enum trns_result start, + struct ccase *c, const size_t *case_nr) { size_t i; assert (chain->finalized); - for (i = 0; i < chain->trns_cnt; ) + for (i = start < 0 ? 0 : start; i < chain->trns_cnt; ) { struct transformation *trns = &chain->trns[i]; int retval = trns->execute (trns->aux, c, *case_nr); @@ -203,8 +202,8 @@ trns_chain_execute (struct trns_chain *chain, struct ccase *c, i++; else if (retval >= 0) i = retval + trns->idx_ofs; - else - return retval; + else + return retval == TRNS_END_CASE ? i + 1 : retval; } return TRNS_CONTINUE;