6 * Copyright (c) 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27 void __attribute__((constructor
)) format_init(void);
28 void __attribute__((destructor
)) format_finalize(void);
31 * Format registry hash table contains the registered formats. Format
32 * registration is typically performed by a format plugin.
33 * TODO: support plugin unload (unregistration of formats).
35 GHashTable
*format_registry
;
37 struct format
*bt_lookup_format(GQuark qname
)
41 return g_hash_table_lookup(format_registry
,
42 (gconstpointer
) (unsigned long) qname
)
45 int bt_register_format(const struct format
*format
)
50 if (bt_lookup_format(qname
))
53 g_hash_table_insert(format_registry
,
54 (gconstpointer
) (unsigned long) format
->name
,
59 void format_init(void)
61 format_registry
= g_hash_table_new(g_direct_hash
, g_direct_equal
);
62 assert(format_registry
);
66 int format_finalize(void)
68 g_hash_table_destroy(format_registry
);
This page took 0.029595 seconds and 4 git commands to generate.