blob: d22579759170573e461990f0158dc37ebf919a52 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#include <glib.h>
#include "atom.h"
static GHashTable *atom_hash;
char *
atom_lookup(char *name)
{
return g_hash_table_lookup(atom_hash,name);
}
char *
atom(char *name)
{
char *id=atom_lookup(name);
if (id)
return id;
id=g_strdup(name);
g_hash_table_insert(atom_hash, id, id);
return id;
}
void
atom_init(void)
{
atom_hash=g_hash_table_new(g_str_hash, g_str_equal);
}
|