- if (!lex_force_id ())
- return false;
- if (dict_lookup_var (default_dict, tokid))
- msg (SW, _("Dummy variable name \"%s\" hides dictionary "
- "variable \"%s\"."),
- tokid, tokid);
- for (iter = block->macros; iter != NULL; iter = iter->next)
- if (!strcasecmp (iter->id, tokid))
- {
- msg (SE, _("Dummy variable name \"%s\" is given twice."), tokid);
- return false;
- }
-
- /* Make a new stand-in variable entry and link it into the
- list. */
- e = pool_alloc (block->pool, sizeof *e);
- e->next = block->macros;
- strcpy (e->id, tokid);
- block->macros = e;
+ if (!lex_force_id (lexer))
+ goto error;
+ name = lex_tokcstr (lexer);
+ if (dict_lookup_var (dict, name))
+ msg (SW, _("Dummy variable name `%s' hides dictionary variable `%s'."),
+ name, name);
+
+ size_t name_len = strlen (name);
+ if (find_dummy_var (dummies, name, name_len))
+ {
+ msg (SE, _("Dummy variable name `%s' is given twice."), name);
+ goto error;
+ }
+
+ /* Make a new macro. */
+ dv = xmalloc (sizeof *dv);
+ dv->name = xmemdup0 (name, name_len);
+ dv->name_len = name_len;
+ dv->values = NULL;
+ dv->n_values = 0;
+ hmap_insert (dummies, &dv->hmap_node, hash_dummy (name, strlen (name)));