Work on bug #550: Avoid exit. In particular the mfile/cfile/bfile has
[idzebra-moved-to-github.git] / index / zinfo.c
index b7d4386..9d5bb3d 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: zinfo.c,v 1.67 2006-06-22 15:07:20 adam Exp $
+/* $Id: zinfo.c,v 1.71 2006-11-14 08:12:08 adam Exp $
    Copyright (C) 1995-2006
    Index Data ApS
 
@@ -15,9 +15,9 @@ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 for more details.
 
 You should have received a copy of the GNU General Public License
-along with Zebra; see the file LICENSE.zebra.  If not, write to the
-Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA.
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
 */
 
 #include <sys/types.h>
@@ -491,7 +491,7 @@ ZebraExplainInfo zebraExplain_open(
             yaz_log(YLOG_DEBUG, "read runnumber=" ZINT_FORMAT, zei->runNumber);
            *zdip = NULL;
        }
-       rec_rm(&trec);
+       rec_free(&trec);
     }
     else  /* create initial targetInfo */
     {
@@ -543,7 +543,7 @@ ZebraExplainInfo zebraExplain_open(
            trec->size[recInfo_storeData] = sgml_len;
                
            rec_put(records, &trec);
-           rec_rm(&trec);
+           rec_free(&trec);
        }
        
        zebraExplain_newDatabase(zei, "IR-Explain-1", 0);
@@ -693,7 +693,7 @@ static void zebraExplain_readAttributeDetails(ZebraExplainInfo zei,
     }
     *zsuip = NULL;
     zad->readFlag = 0;
-    rec_rm (&rec);
+    rec_free(&rec);
 }
 
 static void zebraExplain_readDatabase (ZebraExplainInfo zei,
@@ -738,7 +738,7 @@ static void zebraExplain_readDatabase (ZebraExplainInfo zei,
                                    np->child->u.data.len);
     }
     zdi->readFlag = 0;
-    rec_rm (&rec);
+    rec_free(&rec);
 }
 
 int zebraExplain_removeDatabase(ZebraExplainInfo zei, void *update_handle)
@@ -762,12 +762,12 @@ int zebraExplain_removeDatabase(ZebraExplainInfo zei, void *update_handle)
                
                rec = rec_get(zei->records, zad->sysno);
                (*zei->updateFunc)(zei->updateHandle, rec, 0);
-               rec_rm(&rec);
+               rec_free(&rec);
            }
            /* remove database record keys and delete it */
            rec = rec_get (zei->records, zdi->sysno);
            (*zei->updateFunc)(zei->updateHandle, rec, 0);
-           rec_rm(&rec);
+           rec_free(&rec);
 
            /* remove from list */
            *zdip = zdi->next;
@@ -855,8 +855,7 @@ static void zebraExplain_updateAccessInfo (ZebraExplainInfo zei, data1_node *n,
     if (!c)
     {
         data1_pr_tree (zei->dh, n, stdout);
-        exit (0);
-        assert (c);
+        zebra_exit("zebraExplain_updateAccessInfo");
     }
 
     if ((p = accessInfo->attributeSetIds))
@@ -1360,10 +1359,10 @@ int zebraExplain_lookup_attr_str(ZebraExplainInfo zei,
     assert (zei->curDatabaseInfo);
     for (zsui = &zei->curDatabaseInfo->attributeDetails->SUInfo;
         *zsui; zsui = &(*zsui)->next)
-        if ((*zsui)->info.index_type == index_type
-            && (*zsui)->info.cat == cat
-            && (*zsui)->info.which == ZEB_SU_STR 
-            && !yaz_matchstr((*zsui)->info.u.str, str))
+        if ( (index_type == -1 || (*zsui)->info.index_type == index_type)
+             && (*zsui)->info.cat == cat
+             && (*zsui)->info.which == ZEB_SU_STR 
+             && !yaz_matchstr((*zsui)->info.u.str, str))
         {
             struct zebSUInfoB *zsui_this = *zsui;