pspp-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pspp-cvs] pspp/src/data ChangeLog case.c case.h fastfile.c


From: Ben Pfaff
Subject: [Pspp-cvs] pspp/src/data ChangeLog case.c case.h fastfile.c
Date: Mon, 04 Jun 2007 01:43:28 +0000

CVSROOT:        /cvsroot/pspp
Module name:    pspp
Changes by:     Ben Pfaff <blp> 07/06/04 01:43:28

Modified files:
        src/data       : ChangeLog case.c case.h fastfile.c 

Log message:
        Slightly generalize case_to_values and case_from_values functions, and
        update callers.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/ChangeLog?cvsroot=pspp&r1=1.118&r2=1.119
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/case.c?cvsroot=pspp&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/case.h?cvsroot=pspp&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/fastfile.c?cvsroot=pspp&r1=1.4&r2=1.5

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/pspp/pspp/src/data/ChangeLog,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -b -r1.118 -r1.119
--- ChangeLog   2 Jun 2007 22:02:32 -0000       1.118
+++ ChangeLog   4 Jun 2007 01:43:27 -0000       1.119
@@ -1,3 +1,13 @@
+2007-06-03  Ben Pfaff  <address@hidden>
+
+       Slightly generalize case_to_values and case_from_values functions.
+
+       * case.c (case_to_values): Rename case_copy_out, change interface.
+       (case_from_values): Rename case_copy_in, change interface.
+
+       * fastfile.c (fastfilereader_get_next_case): Update caller.
+       (write_case_to_disk): Ditto.
+
 2007-06-02  Ben Pfaff  <address@hidden>
 
        Clean up after a forgotten part of patch #5829.

Index: case.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/data/case.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- case.c      2 Apr 2007 08:55:51 -0000       1.11
+++ case.c      4 Jun 2007 01:43:27 -0000       1.12
@@ -210,35 +210,33 @@
     }
 }
 
-/* Copies case C to OUTPUT.
-   OUTPUT_SIZE is the number of `union values' in OUTPUT,
-   which must match the number of `union values' in C. */
+/* Copies VALUE_CNT values out of case C to VALUES, starting at
+   the given START_IDX. */
 void
-case_to_values (const struct ccase *c, union value *output,
-                size_t output_size UNUSED) 
+case_copy_out (const struct ccase *c,
+               size_t start_idx, union value *values, size_t value_cnt) 
 {
   assert (c->case_data->ref_cnt > 0);
-  assert (output_size == c->case_data->value_cnt);
-  assert (output != NULL || output_size == 0);
+  assert (value_cnt <= c->case_data->value_cnt);
+  assert (start_idx + value_cnt <= c->case_data->value_cnt);
 
-  memcpy (output, c->case_data->values,
-          c->case_data->value_cnt * sizeof *output);
+  memcpy (values, c->case_data->values + start_idx,
+          value_cnt * sizeof *values);
 }
 
-/* Copies INPUT into case C.
-   INPUT_SIZE is the number of `union values' in INPUT,
-   which must match the number of `union values' in C. */
+/* Copies VALUE_CNT values from VALUES into case C, staring at
+   the given START_IDX. */
 void
-case_from_values (struct ccase *c, const union value *input,
-                  size_t input_size UNUSED) 
+case_copy_in (struct ccase *c,
+              size_t start_idx, const union value *values, size_t value_cnt) 
 {
   assert (c->case_data->ref_cnt > 0);
-  assert (input_size == c->case_data->value_cnt);
-  assert (input != NULL || input_size == 0);
+  assert (value_cnt <= c->case_data->value_cnt);
+  assert (start_idx + value_cnt <= c->case_data->value_cnt);
 
   case_unshare (c);
-  memcpy (c->case_data->values, input,
-          c->case_data->value_cnt * sizeof *input);
+  memcpy (c->case_data->values + start_idx, values,
+          value_cnt * sizeof *values);
 }
 
 /* Returns a pointer to the `union value' used for the

Index: case.h
===================================================================
RCS file: /cvsroot/pspp/pspp/src/data/case.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- case.h      2 Apr 2007 08:55:51 -0000       1.10
+++ case.h      4 Jun 2007 01:43:27 -0000       1.11
@@ -54,9 +54,10 @@
                             const struct ccase *src, size_t src_idx,
                             size_t cnt);
 
-void case_to_values (const struct ccase *, union value *, size_t);
-void case_from_values (struct ccase *,
-                                   const union value *, size_t);
+void case_copy_out (const struct ccase *,
+                       size_t start_idx, union value *, size_t value_cnt);
+void case_copy_in (struct ccase *,
+                       size_t start_idx, const union value *, size_t 
value_cnt);
 
 const union value *case_data (const struct ccase *, const struct variable *);
 double case_num (const struct ccase *, const struct variable *);

Index: fastfile.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/data/fastfile.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- fastfile.c  16 Jan 2007 15:30:28 -0000      1.4
+++ fastfile.c  4 Jun 2007 01:43:27 -0000       1.5
@@ -246,8 +246,7 @@
          ffr->buffer_pos = 0;
        }
 
-      case_from_values (&ffr->c, ffr->buffer + ffr->buffer_pos,
-                       ff->value_cnt);
+      case_copy_in (&ffr->c, 0, ffr->buffer + ffr->buffer_pos, ff->value_cnt);
       ffr->buffer_pos += ff->value_cnt;
       
       read_case = &ffr->c;
@@ -645,7 +644,7 @@
   if (!ff->ok)
     return;
 
-  case_to_values (c, ff->buffer + ff->buffer_used, ff->value_cnt);
+  case_copy_out (c, 0, ff->buffer + ff->buffer_used, ff->value_cnt);
   ff->buffer_used += ff->value_cnt;
   if (ff->buffer_used + ff->value_cnt > ff->buffer_size)
     flush_buffer (ff);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]