A little more checking (for duplicate registration).
authorPeter Verthez <Peter.Verthez@advalvas.be>
Wed, 28 Aug 2002 16:21:32 +0000 (16:21 +0000)
committerPeter Verthez <Peter.Verthez@advalvas.be>
Wed, 28 Aug 2002 16:21:32 +0000 (16:21 +0000)
gedcom/interface.c

index 7556667a253200a4b58ed9d7fab4f0f7f326ec0b..8131341baa1f36fb57b32581fdedad287af4a316 100644 (file)
@@ -32,6 +32,8 @@ static Gedcom_def_cb       default_cb                         = NULL;
 
 void gedcom_set_default_callback(Gedcom_def_cb func)
 {
+  if (default_cb)
+    gedcom_error(_("Internal error: Duplicate registration for default callback"));
   default_cb = func;
 }
 
@@ -39,6 +41,8 @@ void gedcom_subscribe_to_record(Gedcom_rec rec,
                                Gedcom_rec_start_cb cb_start,
                                Gedcom_rec_end_cb cb_end)
 {
+  if (record_start_callback[rec] || record_end_callback[rec])
+    gedcom_error(_("Internal error: Duplicate registration for record type %d\n"), rec);
   if (cb_start) {
     record_start_callback[rec] = cb_start;
     record_end_callback[rec]   = cb_end;
@@ -49,6 +53,8 @@ void gedcom_subscribe_to_element(Gedcom_elt elt,
                                 Gedcom_elt_start_cb cb_start,
                                 Gedcom_elt_end_cb cb_end)
 {
+  if (element_start_callback[elt] || element_end_callback[elt])
+    gedcom_error(_("Internal error: Duplicate registration for element type %d\n"), elt);
   if (cb_start) {
     element_start_callback[elt] = cb_start;
     element_end_callback[elt]   = cb_end;