X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fvariable.c;h=505ae79da395cac5f00de6e57bbcfa91b8fec80e;hb=ccead09ac2bc67bbaa40e67904f6c48f7cdf6700;hp=ccbe65dc0ed9757be75091637bb346b276182d84;hpb=38c2638eed90f33225870563c4be183097e4155a;p=pspp-builds.git diff --git a/src/data/variable.c b/src/data/variable.c index ccbe65dc..505ae79d 100644 --- a/src/data/variable.c +++ b/src/data/variable.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2009 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 @@ -148,17 +148,21 @@ var_clone (const struct variable *old_var) return new_var; } -/* Create a variable to be used for internal calculations only */ +/* Create a variable to be used for internal calculations only. + The variable is assigned a unique dictionary index and a case + index of CASE_IDX. */ struct variable * var_create_internal (int case_idx) { struct variable *v = var_create ("$internal", 0); - struct vardict_info vdi; + static int counter = INT_MAX / 2; vdi.dict = NULL; - vdi.dict_index = 0; vdi.case_index = case_idx; + vdi.dict_index = counter++; + if (counter == INT_MAX) + counter = INT_MAX / 2; var_set_vardict (v, &vdi); @@ -319,7 +323,7 @@ hash_var_by_name (const void *v_, const void *aux UNUSED) { const struct variable *v = v_; - return hsh_hash_case_string (v->name); + return hash_case_string (v->name, 0); } /* A hsh_compare_func that orders pointers to variables A and B @@ -355,7 +359,7 @@ hash_var_ptr_by_name (const void *v_, const void *aux UNUSED) { struct variable *const *v = v_; - return hsh_hash_case_string (var_get_name (*v)); + return hash_case_string (var_get_name (*v), 0); } /* Returns the type of variable V. */ @@ -716,8 +720,8 @@ var_set_label (struct variable *v, const char *label) ss_truncate (&s, 255); if (!ss_is_empty (s)) v->label = ss_xstrdup (s); - dict_var_changed (v); } + dict_var_changed (v); } /* Removes any variable label from V. */