+ /* all the same. new round .. */
+ p->sz_1 = p->sz_2;
+ p->mode_1 = p->mode_2;
+ memcpy(p->key_1, p->key_2, p->sz_1);
+ if (p->mode_1)
+ level = 1; /* insert */
+ else
+ level = -1; /* delete */
+ }
+ }
+ /* outcome is insert (1) or delete (0) depending on final level */
+ if (level > 0)
+ {
+ *insertMode = 1;
+ level--;
+ }
+ else
+ {
+ *insertMode = 0;
+ level++;
+ }
+ p->look_level = level;
+ memcpy(*dst, p->key_1, p->sz_1);
+#if 0
+ pkey(*dst, *insertMode);
+#endif
+ (*dst) += p->sz_1;
+ return 1;
+}
+
+int heap_cread_item(void *vp, char **dst, int *insertMode)
+{
+ struct heap_cread_info *p = (struct heap_cread_info *) vp;
+ struct heap_info *hi = p->hi;
+
+ if (p->first_in_list)
+ {
+ *insertMode = p->key[0];
+ memcpy(*dst, p->key+1, sizeof(struct it_key));
+#if PR_KEY_LOW
+ zebra_log_dict_entry(hi->zh, p->cur_name);
+ pkey(*dst, *insertMode);
+#endif
+ (*dst) += sizeof(struct it_key);
+ p->first_in_list = 0;
+ return 1;
+ }
+ strcpy(p->prev_name, p->cur_name);
+ if (!(p->more = heap_read_one(hi, p->cur_name, p->key)))
+ return 0;
+ if (*p->cur_name && strcmp(p->cur_name, p->prev_name))
+ {
+ p->first_in_list = 1;
+ return 0;
+ }
+ *insertMode = p->key[0];
+ memcpy(*dst, p->key+1, sizeof(struct it_key));
+#if PR_KEY_LOW
+ zebra_log_dict_entry(hi->zh, p->cur_name);
+ pkey(*dst, *insertMode);
+#endif
+ (*dst) += sizeof(struct it_key);
+ return 1;
+}
+
+int heap_inpc(struct heap_cread_info *hci, struct heap_info *hi)
+{
+ ISAMC_I *isamc_i = (ISAMC_I *) xmalloc(sizeof(*isamc_i));
+
+ isamc_i->clientData = hci;
+ isamc_i->read_item = heap_cread_item2;
+
+ while (hci->more)
+ {
+ char this_name[INP_NAME_MAX];
+ ISAM_P isamc_p, isamc_p2;
+ char *dict_info;
+
+ strcpy(this_name, hci->cur_name);
+ assert(hci->cur_name[0]);
+ hi->no_diffs++;
+ if ((dict_info = dict_lookup(hi->reg->dict, hci->cur_name)))
+ {
+ memcpy(&isamc_p, dict_info+1, sizeof(ISAM_P));
+ isamc_p2 = isamc_p;
+ isamc_merge(hi->reg->isamc, &isamc_p2, isamc_i);
+ if (!isamc_p2)
+ {
+ hi->no_deletions++;
+ if (!dict_delete(hi->reg->dict, this_name))
+ abort();
+ }
+ else