X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fvalue-labels.c;h=6d8f517510c59f62f7b29b852f4dd1107e01da45;hb=81579d9e9f994fb2908f50af41c3eb033d216e58;hp=6d6b57a6181b7c156bea52804418cd8771276a53;hpb=d0b91eae59319ab2756d0d43b9cb15eb9cd3c234;p=pspp-builds.git diff --git a/src/data/value-labels.c b/src/data/value-labels.c index 6d6b57a6..6d8f5175 100644 --- a/src/data/value-labels.c +++ b/src/data/value-labels.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2009 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2009, 2010, 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 "value-labels.h" +#include "data/value-labels.h" #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "data/data-out.h" +#include "data/value.h" +#include "data/variable.h" +#include "libpspp/array.h" +#include "libpspp/cast.h" +#include "libpspp/compiler.h" +#include "libpspp/hash-functions.h" +#include "libpspp/hmap.h" +#include "libpspp/intern.h" +#include "libpspp/message.h" +#include "libpspp/str.h" -#include "xalloc.h" +#include "gl/xalloc.h" /* Creates and returns a new, empty set of value labels with the given WIDTH. */ @@ -118,6 +118,13 @@ val_labs_clear (struct val_labs *vls) } } +/* Returns the width of VLS. */ +int +val_labs_get_width (const struct val_labs *vls) +{ + return vls->width; +} + /* Returns the number of value labels in VLS. Returns 0 if VLS is null. */ size_t @@ -131,8 +138,7 @@ do_add_val_lab (struct val_labs *vls, const union value *value, const char *label) { struct val_lab *lab = xmalloc (sizeof *lab); - value_init (&lab->value, vls->width); - value_copy (&lab->value, value, vls->width); + value_clone (&lab->value, value, vls->width); lab->label = intern_new (label); hmap_insert (&vls->labels, &lab->node, value_hash (value, vls->width, 0)); }