projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed bug #14822.
[pspp]
/
src
/
vars-prs.c
diff --git
a/src/vars-prs.c
b/src/vars-prs.c
index 9a559d2e0ca016f3bd894a9e4014c808dc986b9e..7a6e8633c46eee3cefccca4b296443b546daf4d3 100644
(file)
--- a/
src/vars-prs.c
+++ b/
src/vars-prs.c
@@
-14,8
+14,8
@@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 5
9 Temple Place - Suite 330
, Boston, MA
- 0211
1-1307
, USA. */
+ Foundation, Inc., 5
1 Franklin Street, Fifth Floor
, Boston, MA
+ 0211
0-1301
, USA. */
#include <config.h>
#include "var.h"
#include <config.h>
#include "var.h"
@@
-30,6
+30,9
@@
#include "misc.h"
#include "str.h"
#include "misc.h"
#include "str.h"
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+
/* Parses a name as a variable within VS and returns the
variable's index if successful. On failure emits an error
message and returns a null pointer. */
/* Parses a name as a variable within VS and returns the
variable's index if successful. On failure emits an error
message and returns a null pointer. */
@@
-259,7
+262,7
@@
parse_var_set_vars (const struct var_set *vs,
{
int i;
{
int i;
- included = xcalloc (var_set_get_cnt (vs));
+ included = xcalloc (var_set_get_cnt (vs)
, sizeof *included
);
for (i = 0; i < *nv; i++)
included[(*v)[i]->index] = 1;
}
for (i = 0; i < *nv; i++)
included[(*v)[i]->index] = 1;
}
@@
-391,8
+394,8
@@
parse_DATA_LIST_vars (char ***names, int *nnames, int pv_opts)
int d1, d2;
int n;
int nvar, mvar;
int d1, d2;
int n;
int nvar, mvar;
- char
*name1, *name2
;
- char
*root1, *root2
;
+ char
name1[LONG_NAME_LEN + 1], name2[LONG_NAME_LEN + 1]
;
+ char
root1[LONG_NAME_LEN + 1], root2[LONG_NAME_LEN + 1]
;
int success = 0;
assert (names != NULL);
int success = 0;
assert (names != NULL);
@@
-409,10
+412,6
@@
parse_DATA_LIST_vars (char ***names, int *nnames, int pv_opts)
*names = NULL;
}
*names = NULL;
}
- name1 = xmalloc (36);
- name2 = &name1[1 * 9];
- root1 = &name1[2 * 9];
- root2 = &name1[3 * 9];
do
{
if (token != T_ID)
do
{
if (token != T_ID)
@@
-443,7
+442,7
@@
parse_DATA_LIST_vars (char ***names, int *nnames, int pv_opts)
|| !extract_num (name2, root2, &n2, &d2))
goto fail;
|| !extract_num (name2, root2, &n2, &d2))
goto fail;
- if (strcmp (root1, root2))
+ if (strc
asec
mp (root1, root2))
{
msg (SE, _("Prefixes don't match in use of TO convention."));
goto fail;
{
msg (SE, _("Prefixes don't match in use of TO convention."));
goto fail;
@@
-464,8
+463,9
@@
parse_DATA_LIST_vars (char ***names, int *nnames, int pv_opts)
for (n = n1; n <= n2; n++)
{
for (n = n1; n <= n2; n++)
{
- (*names)[nvar] = xmalloc (9);
- sprintf ((*names)[nvar], "%s%0*d", root1, d1, n);
+ char name[LONG_NAME_LEN + 1];
+ sprintf (name, "%s%0*d", root1, d1, n);
+ (*names)[nvar] = xstrdup (name);
nvar++;
}
}
nvar++;
}
}
@@
-489,7
+489,6
@@
parse_DATA_LIST_vars (char ***names, int *nnames, int pv_opts)
fail:
*nnames = nvar;
fail:
*nnames = nvar;
- free (name1);
if (!success)
{
int i;
if (!success)
{
int i;
@@
-594,7
+593,7
@@
var_set_lookup_var_idx (const struct var_set *vs, const char *name)
{
assert (vs != NULL);
assert (name != NULL);
{
assert (vs != NULL);
assert (name != NULL);
- assert (strlen (name) <
9
);
+ assert (strlen (name) <
= LONG_NAME_LEN
);
return vs->lookup_var_idx (vs, name);
}
return vs->lookup_var_idx (vs, name);
}