X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fdata-io%2Fdata-list.c;h=3ee524d5b80001b7ad7e7c81eb3e0d206f5dd48b;hb=6435b289a7c00df2445a491490869d7d1f2bc3bc;hp=4e2f083bee9077f2f69c990624fc6694b8ed0749;hpb=24d4c143974d0cf3258fe2d355695e820c4ff24e;p=pspp diff --git a/src/language/data-io/data-list.c b/src/language/data-io/data-list.c index 4e2f083bee..3ee524d5b8 100644 --- a/src/language/data-io/data-list.c +++ b/src/language/data-io/data-list.c @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -39,7 +40,6 @@ #include #include #include -#include #include #include #include @@ -49,8 +49,8 @@ #include #include -#include "size_max.h" #include "xsize.h" +#include "xalloc.h" #include "gettext.h" #define _(msgid) gettext (msgid) @@ -120,7 +120,7 @@ cmd_data_list (struct lexer *lexer, struct dataset *ds) struct dictionary *dict; struct data_list_pgm *dls; int table = -1; /* Print table if nonzero, -1=undecided. */ - struct file_handle *fh = fh_inline_file (); + struct file_handle *fh = NULL; struct pool *tmp_pool; bool ok; @@ -143,6 +143,7 @@ cmd_data_list (struct lexer *lexer, struct dataset *ds) if (lex_match_id (lexer, "FILE")) { lex_match (lexer, '='); + fh_unref (fh); fh = fh_parse (lexer, FH_REF_FILE | FH_REF_INLINE); if (fh == NULL) goto error; @@ -244,11 +245,19 @@ cmd_data_list (struct lexer *lexer, struct dataset *ds) } } + if (fh == NULL) + fh = fh_inline_file (); fh_set_default_handle (fh); if (dls->type == -1) dls->type = DLS_FIXED; + if (dls->type != DLS_FIXED && dls->end != NULL) + { + msg (SE, _("The END keyword may be used only with DATA LIST FIXED.")); + goto error; + } + if (table == -1) table = dls->type != DLS_FREE; @@ -286,10 +295,12 @@ cmd_data_list (struct lexer *lexer, struct dataset *ds) } pool_destroy (tmp_pool); + fh_unref (fh); return CMD_SUCCESS; error: + fh_unref (fh); data_list_trns_free (dls); return CMD_CASCADING_FAILURE; }