Delete trailing whitespace at end of lines.
[pspp] / src / data / value.c
index 2de3adbae440e32e54e856984056718c5ec0cccb..b4613e4ce3099ec7e8a3a18178958e5179dda5b9 100644 (file)
@@ -1,6 +1,5 @@
 /* PSPP - computes sample statistics.
    Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
-   Written by Ben Pfaff <blp@gnu.org>.
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -38,7 +37,7 @@ value_dup (const union value *val, int width)
    Only the short string portion of longer strings are
    compared. */
 int
-compare_values (const union value *a, const union value *b, int width) 
+compare_values (const union value *a, const union value *b, int width)
 {
   return (width == 0
           ? (a->f < b->f ? -1 : a->f > b->f)
@@ -47,10 +46,32 @@ compare_values (const union value *a, const union value *b, int width)
 
 /* Create a hash of V, which has the given WIDTH.
    Only the short string portion of a longer string is hashed. */
-unsigned 
+unsigned
 hash_value (const union value *v, int width)
 {
   return (width == 0
           ? hsh_hash_double (v->f)
           : hsh_hash_bytes (v->s, MIN (MAX_SHORT_STRING, width)));
 }
+
+/* Copies SRC to DST, given that they both contain data of the
+   given WIDTH. */
+void
+value_copy (union value *dst, const union value *src, int width)
+{
+  if (width == 0)
+    dst->f = src->f;
+  else
+    memcpy (dst->s, src->s, width);
+}
+
+/* Sets V to the system-missing value for data of the given
+   WIDTH. */
+void
+value_set_missing (union value *v, int width)
+{
+  if (width == 0)
+    v->f = SYSMIS;
+  else
+    memset (v->s, ' ', width);
+}