projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
value: Get rid of value_str(), value_str_rw(), value_num().
[pspp]
/
src
/
language
/
stats
/
flip.c
diff --git
a/src/language/stats/flip.c
b/src/language/stats/flip.c
index 68152b1b190b4c90d8754205279f45e623ab75c3..7f4841d2930ff08c2a1d9629ecda18f088f54b60 100644
(file)
--- a/
src/language/stats/flip.c
+++ b/
src/language/stats/flip.c
@@
-144,6
+144,8
@@
cmd_flip (struct lexer *lexer, struct dataset *ds)
break;
}
}
break;
}
}
+ if (flip->n_vars <= 0)
+ goto error;
flip->file = pool_create_temp_file (flip->pool);
if (flip->file == NULL)
flip->file = pool_create_temp_file (flip->pool);
if (flip->file == NULL)
@@
-229,7
+231,7
@@
cmd_flip (struct lexer *lexer, struct dataset *ds)
return CMD_SUCCESS;
error:
return CMD_SUCCESS;
error:
- dict_
destroy
(new_dict);
+ dict_
unref
(new_dict);
destroy_flip_pgm (flip);
return CMD_CASCADING_FAILURE;
}
destroy_flip_pgm (flip);
return CMD_CASCADING_FAILURE;
}
@@
-269,9
+271,15
@@
make_new_var (struct dictionary *dict, const char *name_)
}
*cp = '\0';
}
*cp = '\0';
+ if (strlen (name) == 0)
+ {
+ free (name);
+ name = xstrdup ("v");
+ }
+
/* Use the mangled name, if it is available, or add numeric
extensions until we find one that is. */
/* Use the mangled name, if it is available, or add numeric
extensions until we find one that is. */
- if (!dict_create_var (dict, name, 0))
+ if (!
id_is_plausible (name, false) || !
dict_create_var (dict, name, 0))
{
int len = strlen (name);
int i;
{
int len = strlen (name);
int i;
@@
-282,7
+290,7
@@
make_new_var (struct dictionary *dict, const char *name_)
strncpy (n, name, ofs);
sprintf (&n[ofs], "%d", i);
strncpy (n, name, ofs);
sprintf (&n[ofs], "%d", i);
- if (dict_create_var (dict, n, 0))
+ if (
id_is_plausible (n, false) &&
dict_create_var (dict, n, 0))
break;
}
}
break;
}
}
@@
-443,7
+451,7
@@
flip_casereader_read (struct casereader *reader, void *flip_)
Returns true if successful read, false if an I/O occurred
during destruction or previously. */
static void
Returns true if successful read, false if an I/O occurred
during destruction or previously. */
static void
-flip_casereader_destroy (struct casereader *reader
UNUSED
, void *flip_)
+flip_casereader_destroy (struct casereader *reader, void *flip_)
{
struct flip_pgm *flip = flip_;
if (flip->error)
{
struct flip_pgm *flip = flip_;
if (flip->error)