X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fdictionary%2Fsys-file-info.c;h=441054e209b29b3dfdb7434038083dd6df11ce32;hb=refs%2Fbuilds%2F20120610000508%2Fpspp;hp=27b27858b4ca698a8bfe6908e33001e9a7ef48c9;hpb=e195fccfab97205acb29f90fd1168488d49f1573;p=pspp diff --git a/src/language/dictionary/sys-file-info.c b/src/language/dictionary/sys-file-info.c index 27b27858b4..441054e209 100644 --- a/src/language/dictionary/sys-file-info.c +++ b/src/language/dictionary/sys-file-info.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006, 2009, 2010, 2011 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2009, 2010, 2011, 2012 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 @@ -81,7 +81,7 @@ cmd_sysfile_info (struct lexer *lexer, struct dataset *ds UNUSED) if (!h) return CMD_FAILURE; - reader = sfm_open_reader (h, &d, &info); + reader = sfm_open_reader (h, NULL, &d, &info); if (!reader) { fh_unref (h); @@ -138,8 +138,7 @@ cmd_sysfile_info (struct lexer *lexer, struct dataset *ds UNUSED) tab_text (t, 0, 10, TAB_LEFT, _("Charset:")); - tab_text (t, 1, 10, TAB_LEFT, - dict_get_encoding(d) ? dict_get_encoding(d) : _("Unknown")); + tab_text (t, 1, 10, TAB_LEFT, dict_get_encoding (d)); tab_submit (t); @@ -164,6 +163,7 @@ cmd_sysfile_info (struct lexer *lexer, struct dataset *ds UNUSED) dict_destroy (d); fh_unref (h); + sfm_read_info_destroy (&info); return CMD_SUCCESS; } @@ -377,12 +377,15 @@ static void display_attributes (struct tab_table *t, const struct attrset *set, int flags, int c, int r) { - struct attrset_iterator i; - struct attribute *attr; + struct attribute **attrs; + size_t n_attrs; + size_t i; - for (attr = attrset_first (set, &i); attr != NULL; - attr = attrset_next (set, &i)) + n_attrs = attrset_count (set); + attrs = attrset_sorted (set); + for (i = 0; i < n_attrs; i++) { + const struct attribute *attr = attrs[i]; const char *name = attribute_get_name (attr); size_t n_values; size_t i; @@ -401,6 +404,7 @@ display_attributes (struct tab_table *t, const struct attrset *set, int flags, r++; } } + free (attrs); } static void