- {
- struct atom *ap = xmalloc (sizeof *ap);
- ap->string = xstrdup (string);
- ap->ref_count = 1;
- *app = ap;
- return ap;
- }
-}
-
-/* Destroys ATOM. */
-static void
-atom_destroy (struct atom *atom)
-{
- if (atom != NULL)
- {
- assert (atom->ref_count > 0);
- atom->ref_count--;
- if (atom->ref_count == 0)
- hsh_force_delete (atoms, atom);
- }
-}
-
-/* Returns the string associated with ATOM. */
-static char *
-atom_to_string (const struct atom *atom)
-{
- assert (atom != NULL);
-
- return atom->string;
-}
-
-/* A hsh_compare_func that compares A and B. */
-static int
-compare_atoms (const void *a_, const void *b_, const void *aux UNUSED)
-{
- const struct atom *a = a_;
- const struct atom *b = b_;
-
- return strcmp (a->string, b->string);
-}
-
-/* A hsh_hash_func that hashes ATOM. */
-static unsigned
-hash_atom (const void *atom_, const void *aux UNUSED)
-{
- const struct atom *atom = atom_;
-
- return hsh_hash_string (atom->string);
-}
-
-/* A hsh_free_func that destroys ATOM. */
-static void
-free_atom (void *atom_, const void *aux UNUSED)
-{
- struct atom *atom = atom_;
-
- free (atom->string);
- free (atom);