From: Ben Pfaff Date: Sat, 6 Mar 2010 19:26:47 +0000 (-0800) Subject: CROSSTABS: Initialize hash tables for every split, not just once overall. X-Git-Tag: v0.7.5~125 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6bdd39d0747913e5c5d8b0924cd1fe31c5a2808b;p=pspp-builds.git CROSSTABS: Initialize hash tables for every split, not just once overall. Fixes bug #27883, reported by Jason Stover. --- diff --git a/src/language/stats/crosstabs.q b/src/language/stats/crosstabs.q index bb4acafa..fcc8dd12 100644 --- a/src/language/stats/crosstabs.q +++ b/src/language/stats/crosstabs.q @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006, 2009 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2009, 2010 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 @@ -345,6 +345,10 @@ internal_cmd_crosstabs (struct lexer *lexer, struct dataset *ds, case_unref (c); } + /* Initialize hash tables. */ + for (pt = &proc->pivots[0]; pt < &proc->pivots[proc->n_pivots]; pt++) + hmap_init (&pt->data); + /* Tabulate. */ for (; (c = casereader_read (group)) != NULL; case_unref (c)) for (pt = &proc->pivots[0]; pt < &proc->pivots[proc->n_pivots]; pt++) @@ -444,9 +448,6 @@ crs_custom_tables (struct lexer *lexer, struct dataset *ds, pt->n_consts = 0; pt->const_vars = NULL; pt->const_values = NULL; - hmap_init (&pt->data); - pt->entries = NULL; - pt->n_entries = 0; for (j = 0; j < n_by; j++) pt->vars[j] = by[j][by_iter[j]];