From: Ben Pfaff <blp@gnu.org> Date: Fri, 14 Sep 2007 13:45:02 +0000 (+0000) Subject: (dict_clone): Copy case indexes from cloned dictionary. Fixes bug X-Git-Tag: sav-api~1279 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9767bacac9d988bf60a9b3b20338ed36e003c6b;p=pspp (dict_clone): Copy case indexes from cloned dictionary. Fixes bug #21061. Reviewed by John Darrington. --- diff --git a/src/data/ChangeLog b/src/data/ChangeLog index 73e611832f..91a670fb11 100644 --- a/src/data/ChangeLog +++ b/src/data/ChangeLog @@ -1,4 +1,9 @@ -2007-09-13 John Darrinton <john@darrington.wattle.id.au> +2007-09-14 Ben Pfaff <blp@gnu.org> + + * dictionary.c (dict_clone): Copy case indexes from cloned + dictionary. Fixes bug #21061. Reviewed by John Darrington. + +2007-09-13 John Darrington <john@darrington.wattle.id.au> * value.c value.h (create_value): New function. @@ -15,7 +20,7 @@ * casewriter-translator.c (struct casewriter_translator): Ditto. (casewriter_create_translator): Ditto. -2007-08-27 John Darrinton <john@darrington.wattle.id.au> +2007-08-27 John Darrington <john@darrington.wattle.id.au> * sys-file-reader.c (read_display_parameters): Force display width to 8, if the sys file says 0 (like SPSS does). diff --git a/src/data/dictionary.c b/src/data/dictionary.c index 46abaa7316..5d6633bd7a 100644 --- a/src/data/dictionary.c +++ b/src/data/dictionary.c @@ -116,7 +116,13 @@ dict_create (void) } /* Creates and returns a (deep) copy of an existing - dictionary. */ + dictionary. + + The new dictionary's case indexes are copied from the old + dictionary. If the new dictionary won't be used to access + cases produced with the old dictionary, then the new + dictionary's case indexes should be compacted with + dict_compact_values to save space. */ struct dictionary * dict_clone (const struct dictionary *s) { @@ -135,6 +141,8 @@ dict_clone (const struct dictionary *s) for (i = 0; i < var_get_short_name_cnt (sv); i++) var_set_short_name (dv, i, var_get_short_name (sv, i)); + + var_set_vardict (dv, var_get_vardict (sv)); } d->next_value_idx = s->next_value_idx;