[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pspp-cvs] pspp/src/data dictionary.c ChangeLog
From: |
Ben Pfaff |
Subject: |
[Pspp-cvs] pspp/src/data dictionary.c ChangeLog |
Date: |
Fri, 07 Mar 2008 06:03:51 +0000 |
CVSROOT: /cvsroot/pspp
Module name: pspp
Changes by: Ben Pfaff <blp> 08/03/07 06:03:51
Modified files:
src/data : dictionary.c ChangeLog
Log message:
(var_name_is_insertable): New function.
(make_hinted_name): Don't accept variable names that match PSPP
keywords. Thanks to Jason Stover for reporting the problem.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/dictionary.c?cvsroot=pspp&r1=1.52&r2=1.53
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/ChangeLog?cvsroot=pspp&r1=1.192&r2=1.193
Patches:
Index: dictionary.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/data/dictionary.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -b -r1.52 -r1.53
--- dictionary.c 2 Feb 2008 06:58:12 -0000 1.52
+++ dictionary.c 7 Mar 2008 06:03:51 -0000 1.53
@@ -729,6 +729,18 @@
return true;
}
+/* Returns true if a variable named NAME may be inserted in DICT;
+ that is, if there is not already a variable with that name in
+ DICT and if NAME is not a reserved word. (The caller's checks
+ have already verified that NAME is otherwise acceptable as a
+ variable name.) */
+static bool
+var_name_is_insertable (const struct dictionary *dict, const char *name)
+{
+ return (dict_lookup_var (dict, name) == NULL
+ && lex_id_to_token (ss_cstr (name)) == T_ID);
+}
+
static bool
make_hinted_name (const struct dictionary *dict, const char *hint,
char name[VAR_NAME_LEN + 1])
@@ -760,7 +772,7 @@
size_t len = strlen (name);
unsigned long int i;
- if (dict_lookup_var (dict, name) == NULL)
+ if (var_name_is_insertable (dict, name))
return true;
for (i = 0; i < ULONG_MAX; i++)
@@ -775,7 +787,7 @@
ofs = MIN (VAR_NAME_LEN - strlen (suffix), len);
strcpy (&name[ofs], suffix);
- if (dict_lookup_var (dict, name) == NULL)
+ if (var_name_is_insertable (dict, name))
return true;
}
}
Index: ChangeLog
===================================================================
RCS file: /cvsroot/pspp/pspp/src/data/ChangeLog,v
retrieving revision 1.192
retrieving revision 1.193
diff -u -b -r1.192 -r1.193
--- ChangeLog 7 Mar 2008 05:28:30 -0000 1.192
+++ ChangeLog 7 Mar 2008 06:03:51 -0000 1.193
@@ -1,5 +1,11 @@
2008-03-06 Ben Pfaff <address@hidden>
+ * dictionary.c (var_name_is_insertable): New function.
+ (make_hinted_name): Don't accept variable names that match PSPP
+ keywords. Thanks to Jason Stover for reporting the problem.
+
+2008-03-06 Ben Pfaff <address@hidden>
+
* format-guesser.c (syntax): Require month names to be spelled out
as English words, so that single characters that happen to be
Roman numerals don't get detected as months. Thanks to John
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pspp-cvs] pspp/src/data dictionary.c ChangeLog,
Ben Pfaff <=