X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=lib%2Fregistry.c;h=3cef63d93cb0966b783819b6e402201303062ab1;hp=829ede9da77bf12dce5da544e3ea0bb3538a8049;hb=f133896d405417ba90ac250d243d4b8e539e98f1;hpb=e419579102094d83539d79ce6af83d9786d387ee diff --git a/lib/registry.c b/lib/registry.c index 829ede9d..3cef63d9 100644 --- a/lib/registry.c +++ b/lib/registry.c @@ -44,6 +44,7 @@ struct format *bt_lookup_format(bt_intern_str name) { if (!init_done) return NULL; + return g_hash_table_lookup(format_registry, (gconstpointer) (unsigned long) name); } @@ -61,6 +62,8 @@ void bt_fprintf_format_list(FILE *fp) { struct walk_data data; + assert(fp); + data.fp = fp; data.iter = 0; @@ -75,6 +78,9 @@ void bt_fprintf_format_list(FILE *fp) int bt_register_format(struct format *format) { + if (!format) + return -EINVAL; + if (!init_done) format_init();