-int heap_inps (struct heap_info *hi)
-{
- struct heap_cread_info hci;
- ISAMS_I isams_i = (ISAMS_I) xmalloc (sizeof(*isams_i));
-
- hci.key = (char *) xmalloc (KEY_SIZE);
- hci.mode = 1;
- hci.hi = hi;
- hci.more = heap_read_one (hi, hci.cur_name, hci.key);
-
- isams_i->clientData = &hci;
- isams_i->read_item = heap_cread_item;
-
- while (hci.more)
- {
- char this_name[INP_NAME_MAX];
- ISAMS_P isams_p;
- char *dict_info;
-
- strcpy (this_name, hci.cur_name);
- assert (hci.cur_name[1]);
- no_diffs++;
- if (!(dict_info = dict_lookup (hi->dict, hci.cur_name)))
- {
- isams_p = isams_merge (hi->isams, isams_i);
- no_insertions++;
- dict_insert (hi->dict, this_name, sizeof(ISAMS_P), &isams_p);
- }
- else
- abort();
- }
- xfree (isams_i);
- return 0;
-}
-
-int heap_inph (struct heap_info *hi)
-{
- struct heap_cread_info hci;
- ISAMH_I isamh_i = (ISAMH_I) xmalloc (sizeof(*isamh_i));
-
- hci.key = (char *) xmalloc (KEY_SIZE);
- hci.mode = 1;
- hci.hi = hi;
- hci.more = heap_read_one (hi, hci.cur_name, hci.key);
-
- isamh_i->clientData = &hci;
- isamh_i->read_item = heap_cread_item;
-
- while (hci.more)
- {
- char this_name[INP_NAME_MAX];
- ISAMH_P isamh_p, isamh_p2;
- char *dict_info;
-
- strcpy (this_name, hci.cur_name);
- assert (hci.cur_name[1]);
- no_diffs++;
- if ((dict_info = dict_lookup (hi->dict, hci.cur_name)))
- {
- memcpy (&isamh_p, dict_info+1, sizeof(ISAMH_P));
- isamh_p2 = isamh_append (hi->isamh, isamh_p, isamh_i);
- if (!isamh_p2)
- {
- no_deletions++;
- if (!dict_delete (hi->dict, this_name))
- abort();
- }
- else
- {
- no_updates++;
- if (isamh_p2 != isamh_p)
- dict_insert (hi->dict, this_name,
- sizeof(ISAMH_P), &isamh_p2);
- }
- }
- else
- {
- isamh_p = isamh_append (hi->isamh, 0, isamh_i);
- no_insertions++;
- dict_insert (hi->dict, this_name, sizeof(ISAMH_P), &isamh_p);
- }
- }
- xfree (isamh_i);
- return 0;
-}
-