X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fdata%2Fvalue.c;h=5e94b68c2ed81b5abf656e29edca9c4df9d26e2f;hb=f49ed94900625697d344071290cf2360293c27e3;hp=20d2a33ec3ef9eae3afa12969ba3927faa9436d5;hpb=480a0746507ce73d26f528b56dc3ed80195096e0;p=pspp diff --git a/src/data/value.c b/src/data/value.c index 20d2a33ec3..5e94b68c2e 100644 --- a/src/data/value.c +++ b/src/data/value.c @@ -53,3 +53,25 @@ hash_value (const union value *v, int width) ? 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); +}