#define _(msgid) gettext (msgid)
/* Information to include in displaying a dictionary. */
-enum
+enum
{
DF_DICT_INDEX = 1 << 0,
DF_FORMATS = 1 << 1,
any_reader = any_reader_open (h);
if (!any_reader)
- return CMD_FAILURE;
+ {
+ free (encoding);
+ return CMD_FAILURE;
+ }
if (encoding && !strcasecmp (encoding, "detect"))
{
report_encodings (h, pool, titles, ids, strings, n_strings);
fh_unref (h);
pool_destroy (pool);
+ free (encoding);
return CMD_SUCCESS;
}
table_item_submit (table_item_create (table, NULL /* XXX */, NULL));
- dict_destroy (d);
+ dict_unref (d);
fh_unref (h);
+ free (encoding);
any_read_info_destroy (&info);
return CMD_SUCCESS;
display_vectors (dataset_dict(ds), sorted);
return CMD_SUCCESS;
}
- else if (lex_match_id (lexer, "SCRATCH"))
+ else if (lex_match_id (lexer, "SCRATCH"))
{
dict_get_vars (dataset_dict (ds), &vl, &n, DC_ORDINARY);
flags = 0;
}
- else
+ else
{
- struct subcommand
+ struct subcommand
{
const char *name;
int flags;
};
- static const struct subcommand subcommands[] =
+ static const struct subcommand subcommands[] =
{
{"@ATTRIBUTES", DF_ATTRIBUTES | DF_AT_ATTRIBUTES},
{"ATTRIBUTES", DF_ATTRIBUTES},
dict_get_vars (dict, &vl, &n, 0);
}
- if (n > 0)
+ if (n > 0)
{
sort (vl, n, sizeof *vl,
(sorted
tab_headers (t, 0, 0, 1, 0);
tab_hline (t, TAL_2, 0, nc - 1, 1);
tab_text (t, 0, 0, TAB_LEFT | TAT_TITLE, _("Variable"));
- if (flags & ~DF_DICT_INDEX)
+ if (flags & ~DF_DICT_INDEX)
tab_text (t, 1, 0, TAB_LEFT | TAT_TITLE,
(flags & ~(DF_DICT_INDEX | DF_VARIABLE_LABELS)
? _("Description") : _("Label")));
}
\f
static bool
-is_at_name (const char *name)
+is_at_name (const char *name)
{
return name[0] == '@' || (name[0] == '$' && name[1] == '@');
}
static size_t
-count_attributes (const struct attrset *set, int flags)
+count_attributes (const struct attrset *set, int flags)
{
struct attrset_iterator i;
struct attribute *attr;
size_t n_attrs;
-
+
n_attrs = 0;
for (attr = attrset_first (set, &i); attr != NULL;
- attr = attrset_next (set, &i))
+ attr = attrset_next (set, &i))
if (flags & DF_AT_ATTRIBUTES || !is_at_name (attribute_get_name (attr)))
n_attrs += attribute_get_n_values (attr);
return n_attrs;
}
static void
-display_data_file_attributes (struct attrset *set, int flags)
+display_data_file_attributes (struct attrset *set, int flags)
{
if (count_attributes (set, flags))
table_item_submit (table_item_create (describe_attributes (set, flags),
}
/* Print/write format, or print and write formats. */
- if (flags & DF_FORMATS)
+ if (flags & DF_FORMATS)
{
const struct fmt_spec *print = var_get_print_format (v);
const struct fmt_spec *write = var_get_write_format (v);