From: Adam Dickmeiss Date: Mon, 29 Oct 2007 11:10:43 +0000 (+0000) Subject: WS changes for function calls. X-Git-Tag: ZEBRA.2.0.20~95 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=09aa21f9fc2a275701c7820a260b75b6323fcc42;p=idzebra-moved-to-github.git WS changes for function calls. --- diff --git a/index/zinfo.c b/index/zinfo.c index d678e67..551e2c2 100644 --- a/index/zinfo.c +++ b/index/zinfo.c @@ -1,4 +1,4 @@ -/* $Id: zinfo.c,v 1.78 2007-04-16 08:44:32 adam Exp $ +/* $Id: zinfo.c,v 1.79 2007-10-29 11:10:43 adam Exp $ Copyright (C) 1995-2007 Index Data ApS @@ -221,7 +221,7 @@ void zebraExplain_close(ZebraExplainInfo zei) nmem_destroy(zei->nmem); } -void zebraExplain_mergeOids (ZebraExplainInfo zei, data1_node *n, +void zebraExplain_mergeOids(ZebraExplainInfo zei, data1_node *n, zebAccessObject *op) { data1_node *np; @@ -361,7 +361,7 @@ ZebraExplainInfo zebraExplain_open( zei->nmem = nmem; zei->dh = dh; - data1_get_absyn (zei->dh, "explain", DATA1_XPATH_INDEXING_DISABLE); + data1_get_absyn(zei->dh, "explain", DATA1_XPATH_INDEXING_DISABLE); zei->attsets = 0; zei->res = res; @@ -462,18 +462,18 @@ ZebraExplainInfo zebraExplain_open( (*zdip)->data1_database = 0; (*zdip)->recordCount = 0; (*zdip)->recordBytes = 0; - zebraExplain_mergeAccessInfo (zei, 0, &(*zdip)->accessInfo); + zebraExplain_mergeAccessInfo(zei, 0, &(*zdip)->accessInfo); (*zdip)->databaseName = (char *) - nmem_malloc (zei->nmem, 1+node_name->u.data.len); + nmem_malloc(zei->nmem, 1+node_name->u.data.len); memcpy((*zdip)->databaseName, node_name->u.data.data, node_name->u.data.len); (*zdip)->databaseName[node_name->u.data.len] = '\0'; - (*zdip)->sysno = atoi_zn (node_id->u.data.data, + (*zdip)->sysno = atoi_zn(node_id->u.data.data, node_id->u.data.len); (*zdip)->attributeDetails = (zebAttributeDetails) - nmem_malloc (zei->nmem, sizeof(*(*zdip)->attributeDetails)); - (*zdip)->attributeDetails->sysno = atoi_zn (node_aid->u.data.data, + nmem_malloc(zei->nmem, sizeof(*(*zdip)->attributeDetails)); + (*zdip)->attributeDetails->sysno = atoi_zn(node_aid->u.data.data, node_aid->u.data.len); (*zdip)->attributeDetails->readFlag = 1; (*zdip)->attributeDetails->dirty = 0; @@ -486,19 +486,19 @@ ZebraExplainInfo zebraExplain_open( np = data1_search_tag(zei->dh, node_zebra->child, "ordinalSU"); np = np->child; - assert (np && np->which == DATA1N_data); + assert(np && np->which == DATA1N_data); zei->ordinalSU = atoi_n(np->u.data.data, np->u.data.len); np = data1_search_tag(zei->dh, node_zebra->child, "ordinalDatabase"); np = np->child; - assert (np && np->which == DATA1N_data); + assert(np && np->which == DATA1N_data); zei->ordinalDatabase = atoi_n(np->u.data.data, np->u.data.len); np = data1_search_tag(zei->dh, node_zebra->child, "runNumber"); np = np->child; - assert (np && np->which == DATA1N_data); + assert(np && np->which == DATA1N_data); zei->runNumber = atoi_zn(np->u.data.data, np->u.data.len); yaz_log(YLOG_DEBUG, "read runnumber=" ZINT_FORMAT, zei->runNumber); *zdip = 0; @@ -590,7 +590,7 @@ static void zebraExplain_readAttributeDetails(ZebraExplainInfo zei, struct zebSUInfoB **zsuip = &zad->SUInfo; data1_node *node_adinfo, *node_zebra, *node_list, *np; - assert (zad->sysno); + assert(zad->sysno); rec = rec_get(zei->records, zad->sysno); zad->data1_tree = read_sgml_rec(zei->dh, zei->nmem, rec); @@ -699,7 +699,7 @@ static void zebraExplain_readAttributeDetails(ZebraExplainInfo zei, yaz_log(YLOG_WARN, "Missing set/use/str in attribute info"); continue; } - (*zsuip)->info.ordinal = atoi_n (node_ordinal->u.data.data, + (*zsuip)->info.ordinal = atoi_n(node_ordinal->u.data.data, node_ordinal->u.data.len); zsuip = &(*zsuip)->next; } @@ -708,45 +708,45 @@ static void zebraExplain_readAttributeDetails(ZebraExplainInfo zei, rec_free(&rec); } -static void zebraExplain_readDatabase (ZebraExplainInfo zei, - struct zebDatabaseInfoB *zdi) +static void zebraExplain_readDatabase(ZebraExplainInfo zei, + struct zebDatabaseInfoB *zdi) { Record rec; data1_node *node_dbinfo, *node_zebra, *np; - assert (zdi->sysno); - rec = rec_get (zei->records, zdi->sysno); + assert(zdi->sysno); + rec = rec_get(zei->records, zdi->sysno); - zdi->data1_database = read_sgml_rec (zei->dh, zei->nmem, rec); + zdi->data1_database = read_sgml_rec(zei->dh, zei->nmem, rec); - node_dbinfo = data1_search_tag (zei->dh, zdi->data1_database, + node_dbinfo = data1_search_tag(zei->dh, zdi->data1_database, "/databaseInfo"); - assert (node_dbinfo); - zebraExplain_mergeAccessInfo (zei, node_dbinfo, &zdi->accessInfo); + assert(node_dbinfo); + zebraExplain_mergeAccessInfo(zei, node_dbinfo, &zdi->accessInfo); - node_zebra = data1_search_tag (zei->dh, node_dbinfo->child, + node_zebra = data1_search_tag(zei->dh, node_dbinfo->child, "zebraInfo"); if (node_zebra - && (np = data1_search_tag (zei->dh, node_zebra->child, + && (np = data1_search_tag(zei->dh, node_zebra->child, "recordBytes")) && np->child && np->child->which == DATA1N_data) - zdi->recordBytes = atoi_zn (np->child->u.data.data, + zdi->recordBytes = atoi_zn(np->child->u.data.data, np->child->u.data.len); if (node_zebra - && (np = data1_search_tag (zei->dh, node_zebra->child, + && (np = data1_search_tag(zei->dh, node_zebra->child, "ordinalDatabase")) && np->child && np->child->which == DATA1N_data) zdi->ordinalDatabase = atoi_n(np->child->u.data.data, np->child->u.data.len); - if ((np = data1_search_tag (zei->dh, node_dbinfo->child, + if ((np = data1_search_tag(zei->dh, node_dbinfo->child, "recordCount")) && - (np = data1_search_tag (zei->dh, np->child, + (np = data1_search_tag(zei->dh, np->child, "recordCountActual")) && np->child->which == DATA1N_data) { - zdi->recordCount = atoi_zn (np->child->u.data.data, + zdi->recordCount = atoi_zn(np->child->u.data.data, np->child->u.data.len); } zdi->readFlag = 0; @@ -777,7 +777,7 @@ int zebraExplain_removeDatabase(ZebraExplainInfo zei, void *update_handle) rec_free(&rec); } /* remove database record keys and delete it */ - rec = rec_get (zei->records, zdi->sysno); + rec = rec_get(zei->records, zdi->sysno); (*zei->updateFunc)(zei->updateHandle, rec, 0); rec_free(&rec); @@ -792,23 +792,23 @@ int zebraExplain_removeDatabase(ZebraExplainInfo zei, void *update_handle) return -1; } -int zebraExplain_curDatabase (ZebraExplainInfo zei, const char *database) +int zebraExplain_curDatabase(ZebraExplainInfo zei, const char *database) { struct zebDatabaseInfoB *zdi; - const char *database_n = strrchr (database, '/'); + const char *database_n = strrchr(database, '/'); if (database_n) database_n++; else database_n = database; - assert (zei); + assert(zei); if (zei->curDatabaseInfo && - !STRCASECMP (zei->curDatabaseInfo->databaseName, database)) + !STRCASECMP(zei->curDatabaseInfo->databaseName, database)) return 0; for (zdi = zei->databaseInfo; zdi; zdi=zdi->next) { - if (!STRCASECMP (zdi->databaseName, database_n)) + if (!STRCASECMP(zdi->databaseName, database_n)) break; } if (!zdi) @@ -821,75 +821,75 @@ int zebraExplain_curDatabase (ZebraExplainInfo zei, const char *database) #if ZINFO_DEBUG yaz_log(YLOG_LOG, "zebraExplain_readDatabase: %s", database); #endif - zebraExplain_readDatabase (zei, zdi); + zebraExplain_readDatabase(zei, zdi); } if (zdi->attributeDetails->readFlag) { #if ZINFO_DEBUG yaz_log(YLOG_LOG, "zebraExplain_readAttributeDetails: %s", database); #endif - zebraExplain_readAttributeDetails (zei, zdi->attributeDetails); + zebraExplain_readAttributeDetails(zei, zdi->attributeDetails); } zei->curDatabaseInfo = zdi; return 0; } -static void zebraExplain_initCommonInfo (ZebraExplainInfo zei, data1_node *n) +static void zebraExplain_initCommonInfo(ZebraExplainInfo zei, data1_node *n) { - data1_node *c = data1_mk_tag (zei->dh, zei->nmem, "commonInfo", 0, n); - data1_mk_tag_data_text (zei->dh, c, "dateAdded", zei->date, zei->nmem); - data1_mk_tag_data_text (zei->dh, c, "dateChanged", zei->date, zei->nmem); - data1_mk_tag_data_text (zei->dh, c, "languageCode", "EN", zei->nmem); + data1_node *c = data1_mk_tag(zei->dh, zei->nmem, "commonInfo", 0, n); + data1_mk_tag_data_text(zei->dh, c, "dateAdded", zei->date, zei->nmem); + data1_mk_tag_data_text(zei->dh, c, "dateChanged", zei->date, zei->nmem); + data1_mk_tag_data_text(zei->dh, c, "languageCode", "EN", zei->nmem); } -static void zebraExplain_updateCommonInfo (ZebraExplainInfo zei, data1_node *n) +static void zebraExplain_updateCommonInfo(ZebraExplainInfo zei, data1_node *n) { - data1_node *c = data1_search_tag (zei->dh, n->child, "commonInfo"); - assert (c); - data1_mk_tag_data_text_uni (zei->dh, c, "dateChanged", zei->date, + data1_node *c = data1_search_tag(zei->dh, n->child, "commonInfo"); + assert(c); + data1_mk_tag_data_text_uni(zei->dh, c, "dateChanged", zei->date, zei->nmem); } -static void zebraExplain_initAccessInfo (ZebraExplainInfo zei, data1_node *n) +static void zebraExplain_initAccessInfo(ZebraExplainInfo zei, data1_node *n) { - data1_node *c = data1_mk_tag (zei->dh, zei->nmem, "accessInfo", 0, n); - data1_node *d = data1_mk_tag (zei->dh, zei->nmem, "unitSystems", 0, c); - data1_mk_tag_data_text (zei->dh, d, "string", "ISO", zei->nmem); + data1_node *c = data1_mk_tag(zei->dh, zei->nmem, "accessInfo", 0, n); + data1_node *d = data1_mk_tag(zei->dh, zei->nmem, "unitSystems", 0, c); + data1_mk_tag_data_text(zei->dh, d, "string", "ISO", zei->nmem); } -static void zebraExplain_updateAccessInfo (ZebraExplainInfo zei, data1_node *n, +static void zebraExplain_updateAccessInfo(ZebraExplainInfo zei, data1_node *n, zebAccessInfo accessInfo) { - data1_node *c = data1_search_tag (zei->dh, n->child, "accessInfo"); + data1_node *c = data1_search_tag(zei->dh, n->child, "accessInfo"); data1_node *d; zebAccessObject p; if (!c) { - data1_pr_tree (zei->dh, n, stdout); + data1_pr_tree(zei->dh, n, stdout); zebra_exit("zebraExplain_updateAccessInfo"); } if ((p = accessInfo->attributeSetIds)) { - d = data1_mk_tag_uni (zei->dh, zei->nmem, "attributeSetIds", c); + d = data1_mk_tag_uni(zei->dh, zei->nmem, "attributeSetIds", c); for (; p; p = p->next) - data1_mk_tag_data_oid (zei->dh, d, "oid", p->oid, zei->nmem); + data1_mk_tag_data_oid(zei->dh, d, "oid", p->oid, zei->nmem); } if ((p = accessInfo->schemas)) { - d = data1_mk_tag_uni (zei->dh, zei->nmem, "schemas", c); + d = data1_mk_tag_uni(zei->dh, zei->nmem, "schemas", c); for (; p; p = p->next) - data1_mk_tag_data_oid (zei->dh, d, "oid", p->oid, zei->nmem); + data1_mk_tag_data_oid(zei->dh, d, "oid", p->oid, zei->nmem); } } -int zebraExplain_newDatabase (ZebraExplainInfo zei, const char *database, +int zebraExplain_newDatabase(ZebraExplainInfo zei, const char *database, int explain_database) { struct zebDatabaseInfoB *zdi; data1_node *node_dbinfo, *node_adinfo; - const char *database_n = strrchr (database, '/'); + const char *database_n = strrchr(database, '/'); if (database_n) database_n++; @@ -899,81 +899,81 @@ int zebraExplain_newDatabase (ZebraExplainInfo zei, const char *database, #if ZINFO_DEBUG yaz_log(YLOG_LOG, "zebraExplain_newDatabase: %s", database); #endif - assert (zei); + assert(zei); for (zdi = zei->databaseInfo; zdi; zdi=zdi->next) { - if (!STRCASECMP (zdi->databaseName, database_n)) + if (!STRCASECMP(zdi->databaseName, database_n)) break; } if (zdi) return -1; /* it's new really. make it */ - zdi = (struct zebDatabaseInfoB *) nmem_malloc (zei->nmem, sizeof(*zdi)); + zdi = (struct zebDatabaseInfoB *) nmem_malloc(zei->nmem, sizeof(*zdi)); zdi->next = zei->databaseInfo; zei->databaseInfo = zdi; zdi->sysno = 0; zdi->recordCount = 0; zdi->recordBytes = 0; zdi->readFlag = 0; - zdi->databaseName = nmem_strdup (zei->nmem, database_n); + zdi->databaseName = nmem_strdup(zei->nmem, database_n); zdi->ordinalDatabase = zei->ordinalDatabase++; - zebraExplain_mergeAccessInfo (zei, 0, &zdi->accessInfo); + zebraExplain_mergeAccessInfo(zei, 0, &zdi->accessInfo); - assert (zei->dh); - assert (zei->nmem); + assert(zei->dh); + assert(zei->nmem); zdi->data1_database = - data1_read_sgml (zei->dh, zei->nmem, + data1_read_sgml(zei->dh, zei->nmem, "DatabaseInfo\n" "\n"); if (!zdi->data1_database) return -2; - node_dbinfo = data1_search_tag (zei->dh, zdi->data1_database, + node_dbinfo = data1_search_tag(zei->dh, zdi->data1_database, "/databaseInfo"); - assert (node_dbinfo); + assert(node_dbinfo); - zebraExplain_initCommonInfo (zei, node_dbinfo); - zebraExplain_initAccessInfo (zei, node_dbinfo); + zebraExplain_initCommonInfo(zei, node_dbinfo); + zebraExplain_initAccessInfo(zei, node_dbinfo); - data1_mk_tag_data_text (zei->dh, node_dbinfo, "name", + data1_mk_tag_data_text(zei->dh, node_dbinfo, "name", database, zei->nmem); if (explain_database) - data1_mk_tag_data_text (zei->dh, node_dbinfo, "explainDatabase", + data1_mk_tag_data_text(zei->dh, node_dbinfo, "explainDatabase", "", zei->nmem); - data1_mk_tag_data_text (zei->dh, node_dbinfo, "userFee", + data1_mk_tag_data_text(zei->dh, node_dbinfo, "userFee", "0", zei->nmem); - data1_mk_tag_data_text (zei->dh, node_dbinfo, "available", + data1_mk_tag_data_text(zei->dh, node_dbinfo, "available", "1", zei->nmem); #if ZINFO_DEBUG - data1_pr_tree (zei->dh, zdi->data1_database, stderr); + data1_pr_tree(zei->dh, zdi->data1_database, stderr); #endif zdi->dirty = 1; zei->dirty = 1; zei->curDatabaseInfo = zdi; zdi->attributeDetails = (zebAttributeDetails) - nmem_malloc (zei->nmem, sizeof(*zdi->attributeDetails)); + nmem_malloc(zei->nmem, sizeof(*zdi->attributeDetails)); zdi->attributeDetails->readFlag = 0; zdi->attributeDetails->sysno = 0; zdi->attributeDetails->dirty = 1; zdi->attributeDetails->SUInfo = 0; zdi->attributeDetails->data1_tree = - data1_read_sgml (zei->dh, zei->nmem, + data1_read_sgml(zei->dh, zei->nmem, "AttributeDetails\n" "\n"); - node_adinfo = data1_search_tag (zei->dh, zdi->attributeDetails->data1_tree, + node_adinfo = data1_search_tag(zei->dh, zdi->attributeDetails->data1_tree, "/attributeDetails"); - assert (node_adinfo); + assert(node_adinfo); - zebraExplain_initCommonInfo (zei, node_adinfo); + zebraExplain_initCommonInfo(zei, node_adinfo); data1_mk_tag_data_text(zei->dh, node_adinfo, "name", database, zei->nmem); @@ -981,7 +981,7 @@ int zebraExplain_newDatabase (ZebraExplainInfo zei, const char *database, } -static void zebraExplain_writeCategoryList (ZebraExplainInfo zei, +static void zebraExplain_writeCategoryList(ZebraExplainInfo zei, struct zebraCategoryListInfo *zcl, int key_flush) { @@ -999,7 +999,7 @@ static void zebraExplain_writeCategoryList (ZebraExplainInfo zei, 0 }; - assert (zcl); + assert(zcl); if (!zcl->dirty) return ; zcl->dirty = 1; @@ -1009,24 +1009,24 @@ static void zebraExplain_writeCategoryList (ZebraExplainInfo zei, yaz_log(YLOG_LOG, "zebraExplain_writeCategoryList"); #endif - drec = createRecord (zei->records, &sysno); + drec = createRecord(zei->records, &sysno); if (!drec) return; - node_ci = data1_search_tag (zei->dh, node_categoryList, + node_ci = data1_search_tag(zei->dh, node_categoryList, "/categoryList"); assert (node_ci); - node_ci = data1_mk_tag (zei->dh, zei->nmem, "categories", 0 /* attr */, + node_ci = data1_mk_tag(zei->dh, zei->nmem, "categories", 0 /* attr */, node_ci); assert (node_ci); for (i = 0; category[i]; i++) { - data1_node *node_cat = data1_mk_tag (zei->dh, zei->nmem, "category", + data1_node *node_cat = data1_mk_tag(zei->dh, zei->nmem, "category", 0 /* attr */, node_ci); - data1_mk_tag_data_text (zei->dh, node_cat, "name", - category[i], zei->nmem); + data1_mk_tag_data_text(zei->dh, node_cat, "name", + category[i], zei->nmem); } /* extract *searchable* keys from it. We do this here, because record count, etc. is affected */ @@ -1035,17 +1035,17 @@ static void zebraExplain_writeCategoryList (ZebraExplainInfo zei, /* convert to "SGML" and write it */ #if ZINFO_DEBUG - data1_pr_tree (zei->dh, node_categoryList, stderr); + data1_pr_tree(zei->dh, node_categoryList, stderr); #endif sgml_buf = data1_nodetoidsgml(zei->dh, node_categoryList, 0, &sgml_len); - drec->info[recInfo_storeData] = (char *) xmalloc (sgml_len); - memcpy (drec->info[recInfo_storeData], sgml_buf, sgml_len); + drec->info[recInfo_storeData] = (char *) xmalloc(sgml_len); + memcpy(drec->info[recInfo_storeData], sgml_buf, sgml_len); drec->size[recInfo_storeData] = sgml_len; - rec_put (zei->records, &drec); + rec_put(zei->records, &drec); } -static void zebraExplain_writeAttributeDetails (ZebraExplainInfo zei, +static void zebraExplain_writeAttributeDetails(ZebraExplainInfo zei, zebAttributeDetails zad, const char *databaseName, int key_flush) @@ -1065,79 +1065,79 @@ static void zebraExplain_writeAttributeDetails (ZebraExplainInfo zei, data1_pr_tree(zei->dh, zad->data1_tree, stderr); #endif - drec = createRecord (zei->records, &zad->sysno); + drec = createRecord(zei->records, &zad->sysno); if (!drec) return; - assert (zad->data1_tree); + assert(zad->data1_tree); - node_adinfo = data1_search_tag (zei->dh, zad->data1_tree, + node_adinfo = data1_search_tag(zei->dh, zad->data1_tree, "/attributeDetails"); - zebraExplain_updateCommonInfo (zei, node_adinfo); + zebraExplain_updateCommonInfo(zei, node_adinfo); /* zebra info (private) .. no children yet.. so se don't index zebraInfo */ - node_zebra = data1_mk_tag_uni (zei->dh, zei->nmem, + node_zebra = data1_mk_tag_uni(zei->dh, zei->nmem, "zebraInfo", node_adinfo); /* extract *searchable* keys from it. We do this here, because record count, etc. is affected */ if (key_flush) (*zei->updateFunc)(zei->updateHandle, drec, zad->data1_tree); - node_list = data1_mk_tag_uni (zei->dh, zei->nmem, + node_list = data1_mk_tag_uni(zei->dh, zei->nmem, "attrlist", node_zebra); for (zsui = zad->SUInfo; zsui; zsui = zsui->next) { data1_node *node_attr; char index_type_str[2]; - node_attr = data1_mk_tag (zei->dh, zei->nmem, "attr", 0 /* attr */, + node_attr = data1_mk_tag(zei->dh, zei->nmem, "attr", 0 /* attr */, node_list); index_type_str[0] = zsui->info.index_type; index_type_str[1] = '\0'; - data1_mk_tag_data_text (zei->dh, node_attr, "type", + data1_mk_tag_data_text(zei->dh, node_attr, "type", index_type_str, zei->nmem); if (zsui->info.which == ZEB_SU_STR) { - data1_mk_tag_data_text (zei->dh, node_attr, "str", + data1_mk_tag_data_text(zei->dh, node_attr, "str", zsui->info.u.str, zei->nmem); } - data1_mk_tag_data_int (zei->dh, node_attr, "ordinal", + data1_mk_tag_data_int(zei->dh, node_attr, "ordinal", zsui->info.ordinal, zei->nmem); - data1_mk_tag_data_zint (zei->dh, node_attr, "dococcurrences", + data1_mk_tag_data_zint(zei->dh, node_attr, "dococcurrences", zsui->info.doc_occurrences, zei->nmem); - data1_mk_tag_data_zint (zei->dh, node_attr, "termoccurrences", + data1_mk_tag_data_zint(zei->dh, node_attr, "termoccurrences", zsui->info.term_occurrences, zei->nmem); switch(zsui->info.cat) { case zinfo_index_category_index: - data1_mk_tag_data_text (zei->dh, node_attr, "cat", + data1_mk_tag_data_text(zei->dh, node_attr, "cat", "index", zei->nmem); break; case zinfo_index_category_sort: - data1_mk_tag_data_text (zei->dh, node_attr, "cat", + data1_mk_tag_data_text(zei->dh, node_attr, "cat", "sort", zei->nmem); break; case zinfo_index_category_alwaysmatches: - data1_mk_tag_data_text (zei->dh, node_attr, "cat", + data1_mk_tag_data_text(zei->dh, node_attr, "cat", "alwaysmatches", zei->nmem); break; case zinfo_index_category_anchor: - data1_mk_tag_data_text (zei->dh, node_attr, "cat", + data1_mk_tag_data_text(zei->dh, node_attr, "cat", "anchor", zei->nmem); break; } } /* convert to "SGML" and write it */ #if ZINFO_DEBUG - data1_pr_tree (zei->dh, zad->data1_tree, stderr); + data1_pr_tree(zei->dh, zad->data1_tree, stderr); #endif sgml_buf = data1_nodetoidsgml(zei->dh, zad->data1_tree, 0, &sgml_len); - drec->info[recInfo_storeData] = (char *) xmalloc (sgml_len); - memcpy (drec->info[recInfo_storeData], sgml_buf, sgml_len); + drec->info[recInfo_storeData] = (char *) xmalloc(sgml_len); + memcpy(drec->info[recInfo_storeData], sgml_buf, sgml_len); drec->size[recInfo_storeData] = sgml_len; - rec_put (zei->records, &drec); + rec_put(zei->records, &drec); } -static void zebraExplain_writeDatabase (ZebraExplainInfo zei, +static void zebraExplain_writeDatabase(ZebraExplainInfo zei, struct zebDatabaseInfoB *zdi, int key_flush) { @@ -1153,33 +1153,33 @@ static void zebraExplain_writeDatabase (ZebraExplainInfo zei, #if ZINFO_DEBUG yaz_log(YLOG_LOG, "zebraExplain_writeDatabase %s", zdi->databaseName); #endif - drec = createRecord (zei->records, &zdi->sysno); + drec = createRecord(zei->records, &zdi->sysno); if (!drec) return; - assert (zdi->data1_database); + assert(zdi->data1_database); - node_dbinfo = data1_search_tag (zei->dh, zdi->data1_database, + node_dbinfo = data1_search_tag(zei->dh, zdi->data1_database, "/databaseInfo"); - assert (node_dbinfo); - zebraExplain_updateCommonInfo (zei, node_dbinfo); - zebraExplain_updateAccessInfo (zei, node_dbinfo, zdi->accessInfo); + assert(node_dbinfo); + zebraExplain_updateCommonInfo(zei, node_dbinfo); + zebraExplain_updateAccessInfo(zei, node_dbinfo, zdi->accessInfo); /* record count */ - node_count = data1_mk_tag_uni (zei->dh, zei->nmem, + node_count = data1_mk_tag_uni(zei->dh, zei->nmem, "recordCount", node_dbinfo); - data1_mk_tag_data_zint (zei->dh, node_count, "recordCountActual", + data1_mk_tag_data_zint(zei->dh, node_count, "recordCountActual", zdi->recordCount, zei->nmem); /* zebra info (private) */ - node_zebra = data1_mk_tag_uni (zei->dh, zei->nmem, + node_zebra = data1_mk_tag_uni(zei->dh, zei->nmem, "zebraInfo", node_dbinfo); /* extract *searchable* keys from it. We do this here, because record count, etc. is affected */ if (key_flush) (*zei->updateFunc)(zei->updateHandle, drec, zdi->data1_database); - data1_mk_tag_data_zint (zei->dh, node_zebra, + data1_mk_tag_data_zint(zei->dh, node_zebra, "recordBytes", zdi->recordBytes, zei->nmem); data1_mk_tag_data_zint(zei->dh, node_zebra, @@ -1187,18 +1187,18 @@ static void zebraExplain_writeDatabase (ZebraExplainInfo zei, /* convert to "SGML" and write it */ #if ZINFO_DEBUG - data1_pr_tree (zei->dh, zdi->data1_database, stderr); + data1_pr_tree(zei->dh, zdi->data1_database, stderr); #endif sgml_buf = data1_nodetoidsgml(zei->dh, zdi->data1_database, 0, &sgml_len); - drec->info[recInfo_storeData] = (char *) xmalloc (sgml_len); - memcpy (drec->info[recInfo_storeData], sgml_buf, sgml_len); + drec->info[recInfo_storeData] = (char *) xmalloc(sgml_len); + memcpy(drec->info[recInfo_storeData], sgml_buf, sgml_len); drec->size[recInfo_storeData] = sgml_len; - rec_put (zei->records, &drec); + rec_put(zei->records, &drec); } -static void writeAttributeValues (ZebraExplainInfo zei, +static void writeAttributeValues(ZebraExplainInfo zei, data1_node *node_values, data1_attset *attset) { @@ -1209,24 +1209,24 @@ static void writeAttributeValues (ZebraExplainInfo zei, return; for (c = attset->children; c; c = c->next) - writeAttributeValues (zei, node_values, c->child); + writeAttributeValues(zei, node_values, c->child); for (atts = attset->atts; atts; atts = atts->next) { data1_node *node_value; - node_value = data1_mk_tag (zei->dh, zei->nmem, "attributeValue", + node_value = data1_mk_tag(zei->dh, zei->nmem, "attributeValue", 0 /* attr */, node_values); - data1_mk_tag_data_text (zei->dh, node_value, "name", + data1_mk_tag_data_text(zei->dh, node_value, "name", atts->name, zei->nmem); - node_value = data1_mk_tag (zei->dh, zei->nmem, "value", + node_value = data1_mk_tag(zei->dh, zei->nmem, "value", 0 /* attr */, node_value); - data1_mk_tag_data_int (zei->dh, node_value, "numeric", + data1_mk_tag_data_int(zei->dh, node_value, "numeric", atts->value, zei->nmem); } } -static void zebraExplain_writeAttributeSet (ZebraExplainInfo zei, +static void zebraExplain_writeAttributeSet(ZebraExplainInfo zei, zebAccessObject o, int key_flush) { @@ -1238,48 +1238,48 @@ static void zebraExplain_writeAttributeSet (ZebraExplainInfo zei, struct data1_attset *attset = 0; if (o->oid) - attset = data1_attset_search_id (zei->dh, o->oid); + attset = data1_attset_search_id(zei->dh, o->oid); #if ZINFO_DEBUG yaz_log(YLOG_LOG, "zebraExplain_writeAttributeSet %s", attset ? attset->name : ""); #endif - drec = createRecord (zei->records, &o->sysno); + drec = createRecord(zei->records, &o->sysno); if (!drec) return; node_root = - data1_read_sgml (zei->dh, zei->nmem, + data1_read_sgml(zei->dh, zei->nmem, "AttributeSetInfo\n" "\n" ); - node_attinfo = data1_search_tag (zei->dh, node_root, + node_attinfo = data1_search_tag(zei->dh, node_root, "/attributeSetInfo"); - assert (node_attinfo); - zebraExplain_initCommonInfo (zei, node_attinfo); - zebraExplain_updateCommonInfo (zei, node_attinfo); + assert(node_attinfo); + zebraExplain_initCommonInfo(zei, node_attinfo); + zebraExplain_updateCommonInfo(zei, node_attinfo); - data1_mk_tag_data_oid (zei->dh, node_attinfo, + data1_mk_tag_data_oid(zei->dh, node_attinfo, "oid", o->oid, zei->nmem); if (attset && attset->name) - data1_mk_tag_data_text (zei->dh, node_attinfo, + data1_mk_tag_data_text(zei->dh, node_attinfo, "name", attset->name, zei->nmem); - node_attributes = data1_mk_tag_uni (zei->dh, zei->nmem, + node_attributes = data1_mk_tag_uni(zei->dh, zei->nmem, "attributes", node_attinfo); - node_atttype = data1_mk_tag_uni (zei->dh, zei->nmem, + node_atttype = data1_mk_tag_uni(zei->dh, zei->nmem, "attributeType", node_attributes); - data1_mk_tag_data_text (zei->dh, node_atttype, + data1_mk_tag_data_text(zei->dh, node_atttype, "name", "Use", zei->nmem); - data1_mk_tag_data_text (zei->dh, node_atttype, + data1_mk_tag_data_text(zei->dh, node_atttype, "description", "Use Attribute", zei->nmem); - data1_mk_tag_data_int (zei->dh, node_atttype, + data1_mk_tag_data_int(zei->dh, node_atttype, "type", 1, zei->nmem); - node_values = data1_mk_tag (zei->dh, zei->nmem, + node_values = data1_mk_tag(zei->dh, zei->nmem, "attributeValues", 0 /* attr */, node_atttype); if (attset) - writeAttributeValues (zei, node_values, attset); + writeAttributeValues(zei, node_values, attset); /* extract *searchable* keys from it. We do this here, because record count, etc. is affected */ @@ -1287,17 +1287,17 @@ static void zebraExplain_writeAttributeSet (ZebraExplainInfo zei, (*zei->updateFunc)(zei->updateHandle, drec, node_root); /* convert to "SGML" and write it */ #if ZINFO_DEBUG - data1_pr_tree (zei->dh, node_root, stderr); + data1_pr_tree(zei->dh, node_root, stderr); #endif sgml_buf = data1_nodetoidsgml(zei->dh, node_root, 0, &sgml_len); - drec->info[recInfo_storeData] = (char *) xmalloc (sgml_len); - memcpy (drec->info[recInfo_storeData], sgml_buf, sgml_len); + drec->info[recInfo_storeData] = (char *) xmalloc(sgml_len); + memcpy(drec->info[recInfo_storeData], sgml_buf, sgml_len); drec->size[recInfo_storeData] = sgml_len; - rec_put (zei->records, &drec); + rec_put(zei->records, &drec); } -static void zebraExplain_writeTarget (ZebraExplainInfo zei, int key_flush) +static void zebraExplain_writeTarget(ZebraExplainInfo zei, int key_flush) { struct zebDatabaseInfoB *zdi; data1_node *node_tgtinfo, *node_list, *node_zebra; @@ -1310,56 +1310,56 @@ static void zebraExplain_writeTarget (ZebraExplainInfo zei, int key_flush) zei->dirty = 0; trec = rec_get_root(zei->records); - xfree (trec->info[recInfo_storeData]); + xfree(trec->info[recInfo_storeData]); - node_tgtinfo = data1_search_tag (zei->dh, zei->data1_target, + node_tgtinfo = data1_search_tag(zei->dh, zei->data1_target, "/targetInfo"); - assert (node_tgtinfo); + assert(node_tgtinfo); - zebraExplain_updateCommonInfo (zei, node_tgtinfo); - zebraExplain_updateAccessInfo (zei, node_tgtinfo, zei->accessInfo); + zebraExplain_updateCommonInfo(zei, node_tgtinfo); + zebraExplain_updateAccessInfo(zei, node_tgtinfo, zei->accessInfo); - node_zebra = data1_mk_tag_uni (zei->dh, zei->nmem, + node_zebra = data1_mk_tag_uni(zei->dh, zei->nmem, "zebraInfo", node_tgtinfo); /* convert to "SGML" and write it */ if (key_flush) (*zei->updateFunc)(zei->updateHandle, trec, zei->data1_target); - data1_mk_tag_data_text (zei->dh, node_zebra, "version", + data1_mk_tag_data_text(zei->dh, node_zebra, "version", ZEBRAVER, zei->nmem); - node_list = data1_mk_tag (zei->dh, zei->nmem, + node_list = data1_mk_tag(zei->dh, zei->nmem, "databaseList", 0 /* attr */, node_zebra); for (zdi = zei->databaseInfo; zdi; zdi = zdi->next) { data1_node *node_db; - node_db = data1_mk_tag (zei->dh, zei->nmem, + node_db = data1_mk_tag(zei->dh, zei->nmem, "database", 0 /* attr */, node_list); - data1_mk_tag_data_text (zei->dh, node_db, "name", + data1_mk_tag_data_text(zei->dh, node_db, "name", zdi->databaseName, zei->nmem); - data1_mk_tag_data_zint (zei->dh, node_db, "id", + data1_mk_tag_data_zint(zei->dh, node_db, "id", zdi->sysno, zei->nmem); - data1_mk_tag_data_zint (zei->dh, node_db, "attributeDetailsId", + data1_mk_tag_data_zint(zei->dh, node_db, "attributeDetailsId", zdi->attributeDetails->sysno, zei->nmem); } - data1_mk_tag_data_int (zei->dh, node_zebra, "ordinalSU", + data1_mk_tag_data_int(zei->dh, node_zebra, "ordinalSU", zei->ordinalSU, zei->nmem); - data1_mk_tag_data_int (zei->dh, node_zebra, "ordinalDatabase", + data1_mk_tag_data_int(zei->dh, node_zebra, "ordinalDatabase", zei->ordinalDatabase, zei->nmem); - data1_mk_tag_data_zint (zei->dh, node_zebra, "runNumber", + data1_mk_tag_data_zint(zei->dh, node_zebra, "runNumber", zei->runNumber, zei->nmem); #if ZINFO_DEBUG - data1_pr_tree (zei->dh, zei->data1_target, stderr); + data1_pr_tree(zei->dh, zei->data1_target, stderr); #endif sgml_buf = data1_nodetoidsgml(zei->dh, zei->data1_target, 0, &sgml_len); - trec->info[recInfo_storeData] = (char *) xmalloc (sgml_len); - memcpy (trec->info[recInfo_storeData], sgml_buf, sgml_len); + trec->info[recInfo_storeData] = (char *) xmalloc(sgml_len); + memcpy(trec->info[recInfo_storeData], sgml_buf, sgml_len); trec->size[recInfo_storeData] = sgml_len; - rec_put (zei->records, &trec); + rec_put(zei->records, &trec); } int zebraExplain_lookup_attr_str(ZebraExplainInfo zei, @@ -1369,7 +1369,7 @@ int zebraExplain_lookup_attr_str(ZebraExplainInfo zei, { struct zebSUInfoB **zsui; - assert (zei->curDatabaseInfo); + assert(zei->curDatabaseInfo); for (zsui = &zei->curDatabaseInfo->attributeDetails->SUInfo; *zsui; zsui = &(*zsui)->next) if ( (index_type == -1 || (*zsui)->info.index_type == index_type) @@ -1403,7 +1403,7 @@ int zebraExplain_trav_ord(ZebraExplainInfo zei, void *handle, } -struct zebSUInfoB *zebraExplain_get_sui_info (ZebraExplainInfo zei, int ord, +struct zebSUInfoB *zebraExplain_get_sui_info(ZebraExplainInfo zei, int ord, int dirty_mark, const char **db) { @@ -1414,7 +1414,7 @@ struct zebSUInfoB *zebraExplain_get_sui_info (ZebraExplainInfo zei, int ord, struct zebSUInfoB **zsui; if (zdb->attributeDetails->readFlag) - zebraExplain_readAttributeDetails (zei, zdb->attributeDetails); + zebraExplain_readAttributeDetails(zei, zdb->attributeDetails); for (zsui = &zdb->attributeDetails->SUInfo; *zsui; zsui = &(*zsui)->next) @@ -1509,21 +1509,21 @@ int zebraExplain_lookup_ord(ZebraExplainInfo zei, int ord, -zebAccessObject zebraExplain_announceOid (ZebraExplainInfo zei, +zebAccessObject zebraExplain_announceOid(ZebraExplainInfo zei, zebAccessObject *op, Odr_oid *oid) { zebAccessObject ao; for (ao = *op; ao; ao = ao->next) - if (!oid_oidcmp (oid, ao->oid)) + if (!oid_oidcmp(oid, ao->oid)) break; if (!ao) { - ao = (zebAccessObject) nmem_malloc (zei->nmem, sizeof(*ao)); + ao = (zebAccessObject) nmem_malloc(zei->nmem, sizeof(*ao)); ao->handle = 0; ao->sysno = 0; - ao->oid = odr_oiddup_nmem (zei->nmem, oid); + ao->oid = odr_oiddup_nmem(zei->nmem, oid); ao->next = *op; *op = ao; } @@ -1536,8 +1536,8 @@ struct zebSUInfoB *zebraExplain_add_sui_info(ZebraExplainInfo zei, { struct zebSUInfoB *zsui; - assert (zei->curDatabaseInfo); - zsui = (struct zebSUInfoB *) nmem_malloc (zei->nmem, sizeof(*zsui)); + assert(zei->curDatabaseInfo); + zsui = (struct zebSUInfoB *) nmem_malloc(zei->nmem, sizeof(*zsui)); zsui->next = zei->curDatabaseInfo->attributeDetails->SUInfo; zei->curDatabaseInfo->attributeDetails->SUInfo = zsui; zei->curDatabaseInfo->attributeDetails->dirty = 1; @@ -1562,16 +1562,16 @@ int zebraExplain_add_attr_str(ZebraExplainInfo zei, return zsui->info.ordinal; } -void zebraExplain_addSchema (ZebraExplainInfo zei, Odr_oid *oid) +void zebraExplain_addSchema(ZebraExplainInfo zei, Odr_oid *oid) { - zebraExplain_announceOid (zei, &zei->accessInfo->schemas, oid); - zebraExplain_announceOid (zei, &zei->curDatabaseInfo-> + zebraExplain_announceOid(zei, &zei->accessInfo->schemas, oid); + zebraExplain_announceOid(zei, &zei->curDatabaseInfo-> accessInfo->schemas, oid); } -void zebraExplain_recordBytesIncrement (ZebraExplainInfo zei, int adjust_num) +void zebraExplain_recordBytesIncrement(ZebraExplainInfo zei, int adjust_num) { - assert (zei->curDatabaseInfo); + assert(zei->curDatabaseInfo); if (adjust_num) { @@ -1580,9 +1580,9 @@ void zebraExplain_recordBytesIncrement (ZebraExplainInfo zei, int adjust_num) } } -void zebraExplain_recordCountIncrement (ZebraExplainInfo zei, int adjust_num) +void zebraExplain_recordCountIncrement(ZebraExplainInfo zei, int adjust_num) { - assert (zei->curDatabaseInfo); + assert(zei->curDatabaseInfo); if (adjust_num) { @@ -1591,7 +1591,7 @@ void zebraExplain_recordCountIncrement (ZebraExplainInfo zei, int adjust_num) } } -zint zebraExplain_runNumberIncrement (ZebraExplainInfo zei, int adjust_num) +zint zebraExplain_runNumberIncrement(ZebraExplainInfo zei, int adjust_num) { if (adjust_num) { @@ -1600,13 +1600,13 @@ zint zebraExplain_runNumberIncrement (ZebraExplainInfo zei, int adjust_num) return zei->runNumber += adjust_num; } -RecordAttr *rec_init_attr (ZebraExplainInfo zei, Record rec) +RecordAttr *rec_init_attr(ZebraExplainInfo zei, Record rec) { RecordAttr *recordAttr; if (rec->info[recInfo_attr]) return (RecordAttr *) rec->info[recInfo_attr]; - recordAttr = (RecordAttr *) xmalloc (sizeof(*recordAttr)); + recordAttr = (RecordAttr *) xmalloc(sizeof(*recordAttr)); memset(recordAttr, '\0', sizeof(*recordAttr)); rec->info[recInfo_attr] = (char *) recordAttr; @@ -1622,7 +1622,7 @@ RecordAttr *rec_init_attr (ZebraExplainInfo zei, Record rec) static void att_loadset(void *p, const char *n, const char *name) { data1_handle dh = (data1_handle) p; - if (!data1_get_attset (dh, name)) + if (!data1_get_attset(dh, name)) yaz_log(YLOG_WARN, "Directive attset failed for %s", name); } @@ -1633,7 +1633,7 @@ int zebraExplain_get_database_ord(ZebraExplainInfo zei) return zei->curDatabaseInfo->ordinalDatabase; } -void zebraExplain_loadAttsets (data1_handle dh, Res res) +void zebraExplain_loadAttsets(data1_handle dh, Res res) { res_trav(res, "attset", dh, att_loadset); }