projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add mutual links to VARIABLE/DATAFILE ATTRIBUTE documentation
[pspp]
/
src
/
language
/
data-io
/
get.c
diff --git
a/src/language/data-io/get.c
b/src/language/data-io/get.c
index 8a8d7859f5139361753d32db57650416e9e9831c..f8a84b142919d59d43f31222bf42c45fdb747b8d 100644
(file)
--- a/
src/language/data-io/get.c
+++ b/
src/language/data-io/get.c
@@
-37,7
+37,6
@@
#include <language/data-io/file-handle.h>
#include <language/lexer/lexer.h>
#include <language/lexer/variable-parser.h>
#include <language/data-io/file-handle.h>
#include <language/lexer/lexer.h>
#include <language/lexer/variable-parser.h>
-#include <libpspp/alloc.h>
#include <libpspp/assertion.h>
#include <libpspp/compiler.h>
#include <libpspp/hash.h>
#include <libpspp/assertion.h>
#include <libpspp/compiler.h>
#include <libpspp/hash.h>
@@
-46,6
+45,8
@@
#include <libpspp/str.h>
#include <libpspp/taint.h>
#include <libpspp/str.h>
#include <libpspp/taint.h>
+#include "xalloc.h"
+
#include "gettext.h"
#define _(msgid) gettext (msgid)
#include "gettext.h"
#define _(msgid) gettext (msgid)
@@
-60,8
+61,7
@@
enum reader_command
IMPORT_CMD
};
IMPORT_CMD
};
-static void get_translate_case (const struct ccase *, struct ccase *,
- void *map_);
+static void get_translate_case (struct ccase *, struct ccase *, void *map_);
static bool get_destroy_case_map (void *map_);
/* Parses a GET or IMPORT command. */
static bool get_destroy_case_map (void *map_);
/* Parses a GET or IMPORT command. */
@@
-81,6
+81,7
@@
parse_read_command (struct lexer *lexer, struct dataset *ds, enum reader_command
{
lex_match (lexer, '=');
{
lex_match (lexer, '=');
+ fh_unref (fh);
fh = fh_parse (lexer, FH_REF_FILE | FH_REF_SCRATCH);
if (fh == NULL)
goto error;
fh = fh_parse (lexer, FH_REF_FILE | FH_REF_SCRATCH);
if (fh == NULL)
goto error;
@@
-121,6
+122,7
@@
parse_read_command (struct lexer *lexer, struct dataset *ds, enum reader_command
if (!parse_dict_trim (lexer, dict))
goto error;
}
if (!parse_dict_trim (lexer, dict))
goto error;
}
+ dict_compact_values (dict);
map = case_map_from_dict (dict);
if (map != NULL)
map = case_map_from_dict (dict);
if (map != NULL)
@@
-132,9
+134,11
@@
parse_read_command (struct lexer *lexer, struct dataset *ds, enum reader_command
proc_set_active_file (ds, reader, dict);
proc_set_active_file (ds, reader, dict);
+ fh_unref (fh);
return CMD_SUCCESS;
error:
return CMD_SUCCESS;
error:
+ fh_unref (fh);
casereader_destroy (reader);
if (dict != NULL)
dict_destroy (dict);
casereader_destroy (reader);
if (dict != NULL)
dict_destroy (dict);
@@
-142,11
+146,12
@@
parse_read_command (struct lexer *lexer, struct dataset *ds, enum reader_command
}
static void
}
static void
-get_translate_case (
const
struct ccase *input, struct ccase *output,
+get_translate_case (struct ccase *input, struct ccase *output,
void *map_)
{
struct case_map *map = map_;
case_map_execute (map, input, output);
void *map_)
{
struct case_map *map = map_;
case_map_execute (map, input, output);
+ case_destroy (input);
}
static bool
}
static bool
@@
-359,9
+364,11
@@
parse_write_command (struct lexer *lexer, struct dataset *ds,
map);
dict_destroy (dict);
map);
dict_destroy (dict);
+ fh_unref (handle);
return writer;
error:
return writer;
error:
+ fh_unref (handle);
casewriter_destroy (writer);
dict_destroy (dict);
case_map_destroy (map);
casewriter_destroy (writer);
dict_destroy (dict);
case_map_destroy (map);
@@
-562,10
+569,10
@@
rename_variables (struct lexer *lexer, struct dictionary *dict)
goto done;
if (nn != nv)
{
goto done;
if (nn != nv)
{
- msg (SE, _("Number of variables on left side of `=' (%
d
) does not "
- "match number of variables on right side (%
d
), in "
+ msg (SE, _("Number of variables on left side of `=' (%
zu
) does not "
+ "match number of variables on right side (%
zu
), in "
"parenthesized group %d of RENAME subcommand."),
"parenthesized group %d of RENAME subcommand."),
-
(unsigned) (nv - old_nv), (unsigned) (nn - old_nv)
, group);
+
nv - old_nv, nn - old_nv
, group);
goto done;
}
if (!lex_force_match (lexer, ')'))
goto done;
}
if (!lex_force_match (lexer, ')'))
@@
-721,8
+728,8
@@
cmd_match_files (struct lexer *lexer, struct dataset *ds)
bool saw_in = false;
struct casereader *active_file = NULL;
bool saw_in = false;
struct casereader *active_file = NULL;
- char first_name[
LONG
_NAME_LEN + 1] = "";
- char last_name[
LONG
_NAME_LEN + 1] = "";
+ char first_name[
VAR
_NAME_LEN + 1] = "";
+ char last_name[
VAR
_NAME_LEN + 1] = "";
struct taint *taint = NULL;
struct taint *taint = NULL;
@@
-1080,6
+1087,7
@@
mtf_close_all_files (struct mtf_proc *mtf)
ll_for_each_preremove (file, struct mtf_file, ll, &mtf->files)
{
ll_for_each_preremove (file, struct mtf_file, ll, &mtf->files)
{
+ fh_unref (file->handle);
casereader_destroy (file->reader);
free (file->by);
dict_destroy (file->dict);
casereader_destroy (file->reader);
free (file->by);
dict_destroy (file->dict);