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 | ATOM_MAGIC_CHECK(a) |
| #define | ATOM_SET_MAGIC(a) |
| #define | ATOM_TYPE_MASK ((size_t) 0x07) |
| #define | ARENA_OFFSET G_STRUCT_OFFSET(struct atom, arena) |
| #define | atom_protect(a, size) |
| #define | atom_unprotect(a, size) |
Typedefs |
| typedef atom | atom_t |
| | Atoms are ref-counted.
|
| typedef size_t(* | len_func_t )(gconstpointer v) |
| typedef const gchar *(* | str_func_t )(gconstpointer v) |
| typedef table_desc | table_desc_t |
| | Description of atom types.
|
Functions |
| atom_t * | atom_from_arena (gconstpointer key) |
| void | atom_check (const atom_t *a) |
| atom_t * | atom_alloc (size_t size) |
| void | atom_dealloc (atom_t *a, size_t size) |
| size_t | str_len (gconstpointer v) |
| const gchar * | str_str (gconstpointer v) |
| size_t | guid_len (gconstpointer v) |
| const gchar * | guid_str (gconstpointer v) |
| size_t | sha1_len (gconstpointer v) |
| const gchar * | sha1_str (gconstpointer v) |
| size_t | tth_len (gconstpointer v) |
| const gchar * | tth_str (gconstpointer v) |
| size_t | uint64_len (gconstpointer v) |
| const gchar * | uint64_str (gconstpointer v) |
| size_t | filesize_len (gconstpointer v) |
| const gchar * | filesize_str (gconstpointer v) |
| guint | binary_hash (const guchar *key, guint len) |
| | Hash `len' bytes 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.
|
| guint | tth_hash (gconstpointer key) |
| | Hash a TTH (24 bytes).
|
| gint | tth_eq (gconstpointer a, gconstpointer b) |
| | Test two TTHs 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.
|
| gint | filesize_eq (gconstpointer a, gconstpointer b) |
| | Test two filesize_t for equality.
|
| guint | filesize_hash (gconstpointer p) |
| | Calculate the 32-bit hash of a filesize_t.
|
| void | atoms_init (void) |
| | Initialize atom structures.
|
| size_t | atom_is_registered (enum atom_type type, gconstpointer key) |
| gconstpointer | atom_get (enum atom_type type, gconstpointer key) |
| | Get atom of given `type', whose value is `key'.
|
| void | atom_free (enum atom_type 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.
|
| GHashTable * | ht_all_atoms |
|
|
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 },
{ "TTH", NULL, tth_hash, tth_eq, tth_len, tth_str },
{ "uint64", NULL, uint64_hash, uint64_eq, uint64_len, uint64_str},
{ "filesize",
NULL, filesize_hash, filesize_eq, filesize_len, filesize_str},
}
The set of all atom types we know about.
|