X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fcase-tmpfile.c;h=58e437ad1b45686000c0b320e028e0f0d8ad641a;hb=18e0d701a5e9a288604a408100efcf1463b6da9c;hp=5744786611a737fb467f8f7c4c9673164696cc40;hpb=5c3291dc396b795696e94f47780308fd7ace6fc4;p=pspp-builds.git diff --git a/src/data/case-tmpfile.c b/src/data/case-tmpfile.c index 57447866..58e437ad 100644 --- a/src/data/case-tmpfile.c +++ b/src/data/case-tmpfile.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010 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 @@ -24,7 +24,7 @@ #include #include -#include +#include #include "error.h" #include "xalloc.h" @@ -36,7 +36,7 @@ struct case_tmpfile struct caseproto *proto; /* Format of cases in the tmpfile. */ size_t case_size; /* Number of bytes per case. */ size_t *offsets; /* Offset to each value. */ - struct tmpfile *tmpfile; /* Temporary file. */ + struct ext_array *ext_array; /* Temporary file. */ }; /* Returns the number of bytes needed to store a value with the @@ -52,7 +52,7 @@ width_to_n_bytes (int width) static void * value_to_data (const union value *value_, int width) { - union value *value = (union value *) value_; + union value *value = CONST_CAST (union value *, value_); assert (sizeof value->f == sizeof (double)); if (width == 0) return &value->f; @@ -72,7 +72,7 @@ case_tmpfile_create (const struct caseproto *proto) ctf = xmalloc (sizeof *ctf); ctf->taint = taint_create (); - ctf->tmpfile = tmpfile_create (); + ctf->ext_array = ext_array_create (); ctf->proto = caseproto_ref (proto); ctf->case_size = 0; n_values = caseproto_get_n_widths (proto); @@ -97,7 +97,7 @@ case_tmpfile_destroy (struct case_tmpfile *ctf) if (ctf != NULL) { struct taint *taint = ctf->taint; - tmpfile_destroy (ctf->tmpfile); + ext_array_destroy (ctf->ext_array); caseproto_unref (ctf->proto); free (ctf->offsets); free (ctf); @@ -149,9 +149,9 @@ case_tmpfile_get_values (const struct case_tmpfile *ctf, { int width = caseproto_get_width (ctf->proto, i); if (width != -1 - && !tmpfile_read (ctf->tmpfile, case_offset + ctf->offsets[i], - width_to_n_bytes (width), - value_to_data (&values[i], width))) + && !ext_array_read (ctf->ext_array, case_offset + ctf->offsets[i], + width_to_n_bytes (width), + value_to_data (&values[i], width))) return false; } return true; @@ -194,9 +194,9 @@ case_tmpfile_put_values (struct case_tmpfile *ctf, { int width = caseproto_get_width (ctf->proto, i); if (width != -1 - && !tmpfile_write (ctf->tmpfile, case_offset + ctf->offsets[i], - width_to_n_bytes (width), - value_to_data (values++, width))) + && !ext_array_write (ctf->ext_array, case_offset + ctf->offsets[i], + width_to_n_bytes (width), + value_to_data (values++, width))) return false; } return true;