An atom is a single piece of information that is likely to be shared and which is therefore only allocated once: all other instances point to the common object.
|
Data Structures |
| union | mem_chunk |
| struct | atom |
| | Atoms are ref-counted. More...
|
| struct | table_desc |
| | Description of atom types. More...
|
Defines |
| #define | ATOMS_SOURCE |
| #define | ARENA_OFFSET G_STRUCT_OFFSET(struct atom, arena) |
| #define | atom_protect(a) |
| #define | atom_unprotect(a) |
| #define | atom_alloc(size) g_malloc(size) |
| #define | atom_dealloc(a) g_free(a) |
Typedefs |
| typedef atom | atom_t |
| | Atoms are ref-counted.
|
| typedef gint(* | len_func_t )(gconstpointer v) |
| typedef const gchar *(* | str_func_t )(gconstpointer v) |
| typedef table_desc | table_desc_t |
| | Description of atom types.
|
Functions |
| | RCSID ("$Id:atoms.c, v 1.21 2005/12/27 16:29:29 cbiere Exp $") |
| gint | str_len (gconstpointer v) |
| const gchar * | str_str (gconstpointer v) |
| gint | guid_len (gconstpointer v) |
| const gchar * | guid_str (gconstpointer v) |
| gint | sha1_len (gconstpointer v) |
| const gchar * | sha1_str (gconstpointer v) |
| gint | uint64_len (gconstpointer v) |
| const gchar * | uint64_str (gconstpointer v) |
| guint | binary_hash (const guchar *key, guint len) |
| | Hash `len' bytes (multiple of 4) starting from `key'.
|
| guint | guid_hash (gconstpointer key) |
| | Hash a GUID (16 bytes).
|
| gint | guid_eq (gconstpointer a, gconstpointer b) |
| | Test two GUIDs for equality.
|
| guint | sha1_hash (gconstpointer key) |
| | Hash a SHA1 (20 bytes).
|
| gint | sha1_eq (gconstpointer a, gconstpointer b) |
| | Test two SHA1s for equality.
|
| gint | uint64_eq (gconstpointer a, gconstpointer b) |
| | Test two 64-bit integers for equality.
|
| guint | uint64_hash (gconstpointer p) |
| | Calculate the 32-bit hash of a 64-bit integer.
|
| void | atoms_init (void) |
| | Initialize atom structures.
|
| gpointer | atom_get (gint type, gconstpointer key) |
| | Get atom of given `type', whose value is `key'.
|
| void | atom_free (gint type, gconstpointer key) |
| | Remove one reference from atom.
|
| gboolean | atom_warn_free (gpointer key, gpointer unused_value, gpointer udata) |
| | Warning about existing atom that should have been freed.
|
| void | atoms_close (void) |
| | Shutdown atom structures, freeing all remaining atoms.
|
Variables |
| table_desc_t | atoms [] |
| | The set of all atom types we know about.
|
|
|
Initial value: {
{ "String", NULL, g_str_hash, g_str_equal, str_len, str_str },
{ "GUID", NULL, guid_hash, guid_eq, guid_len, guid_str },
{ "SHA1", NULL, sha1_hash, sha1_eq, sha1_len, sha1_str },
{ "uint64", NULL, uint64_hash, uint64_eq, uint64_len, uint64_str},
}
The set of all atom types we know about.
|