X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fmath%2Fcategoricals.c;h=5aba65b78e92d35499a886064edb12e1b81ce39d;hb=407f3c634628b92fb6b57cbcff229270107cdddc;hp=6002d8c179aa09529fa7740a676ab7329f2255fa;hpb=ef40d0ff4989b13360acb0504ac5a8fbeff31c16;p=pspp diff --git a/src/math/categoricals.c b/src/math/categoricals.c index 6002d8c179..5aba65b78e 100644 --- a/src/math/categoricals.c +++ b/src/math/categoricals.c @@ -91,14 +91,18 @@ void categoricals_destroy ( struct categoricals *cat) { int i; - for (i = 0 ; i < cat->n_vp; ++i) - hmap_destroy (&cat->vp[i].map); - - pool_destroy (cat->pool); - free (cat); + if (cat != NULL) + { + for (i = 0 ; i < cat->n_vp; ++i) + hmap_destroy (&cat->vp[i].map); + + pool_destroy (cat->pool); + free (cat); + } } +#if 0 void categoricals_dump (const struct categoricals *cat) { @@ -129,8 +133,8 @@ categoricals_dump (const struct categoricals *cat) for (node = hmap_first (m); node; node = hmap_next (m, node)) { struct string s; - ds_init_empty (&s); const struct value_node *vn = HMAP_DATA (node, struct value_node, node); + ds_init_empty (&s); var_append_value_name (vp->var, &vn->value, &s); printf ("Value: %s; Index %d; CC %g\n", ds_cstr (&s), @@ -152,6 +156,7 @@ categoricals_dump (const struct categoricals *cat) printf ("%d ", cat->reverse_variable_map[v]); printf ("\n"); } +#endif