X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fdata%2Fscratch-writer.c;h=2c545c7d01a7520f2bc668759abbff19a495f5a1;hb=d8fdf0b4fa919e48397b438e9453d6b82215ff51;hp=ed88af6db4ee1a211443702de9545c251546abc7;hpb=cc6a060446e71cace2d828a864c85702e04aba7c;p=pspp diff --git a/src/data/scratch-writer.c b/src/data/scratch-writer.c index ed88af6db4..2c545c7d01 100644 --- a/src/data/scratch-writer.c +++ b/src/data/scratch-writer.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2009, 2011 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 @@ -16,23 +16,23 @@ #include -#include "scratch-writer.h" +#include "data/scratch-writer.h" #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "data/case.h" +#include "data/case-map.h" +#include "data/casereader.h" +#include "data/casewriter-provider.h" +#include "data/casewriter.h" +#include "data/dictionary.h" +#include "data/file-handle-def.h" +#include "data/scratch-handle.h" +#include "data/variable.h" +#include "libpspp/compiler.h" +#include "libpspp/taint.h" -#include "xalloc.h" +#include "gl/xalloc.h" #define N_(msgid) (msgid) @@ -59,7 +59,6 @@ scratch_writer_open (struct file_handle *fh, struct scratch_writer *writer; struct casewriter *casewriter; struct fh_lock *lock; - size_t dict_value_cnt; /* Get exclusive write access to handle. */ /* TRANSLATORS: this fragment will be interpolated into @@ -83,10 +82,9 @@ scratch_writer_open (struct file_handle *fh, } else writer->compactor = NULL; - dict_value_cnt = dict_get_next_value_idx (writer->dict); - writer->subwriter = autopaging_writer_create (dict_value_cnt); + writer->subwriter = autopaging_writer_create (dict_get_proto (writer->dict)); - casewriter = casewriter_create (dict_value_cnt, + casewriter = casewriter_create (dict_get_proto (writer->dict), &scratch_writer_casewriter_class, writer); taint_propagate (casewriter_get_taint (writer->subwriter), casewriter_get_taint (casewriter)); @@ -99,15 +97,8 @@ scratch_writer_casewriter_write (struct casewriter *w UNUSED, void *writer_, struct ccase *c) { struct scratch_writer *writer = writer_; - struct ccase tmp; - if (writer->compactor) - { - case_map_execute (writer->compactor, c, &tmp); - case_destroy (c); - } - else - case_move (&tmp, c); - casewriter_write (writer->subwriter, &tmp); + casewriter_write (writer->subwriter, + case_map_execute (writer->compactor, c)); } /* Closes WRITER. */