/[zanavi_public1]/navit/navit/atom.c
ZANavi

Contents of /navit/navit/atom.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (show annotations) (download)
Fri Oct 28 21:19:04 2011 UTC (8 years, 9 months ago) by zoff99
File MIME type: text/plain
File size: 445 byte(s)
import files
1 #include <glib.h>
2 #include "atom.h"
3
4 static GHashTable *atom_hash;
5
6 char *
7 atom_lookup(char *name)
8 {
9 if (!atom_hash)
10 return NULL;
11 return g_hash_table_lookup(atom_hash,name);
12 }
13
14 char *
15 atom(char *name)
16 {
17 char *id=atom_lookup(name);
18 if (id)
19 return id;
20 if (!atom_hash)
21 return NULL;
22 id=g_strdup(name);
23 g_hash_table_insert(atom_hash, id, id);
24 return id;
25 }
26
27 void
28 atom_init(void)
29 {
30 atom_hash=g_hash_table_new(g_str_hash, g_str_equal);
31 }

   
Visit the ZANavi Wiki