From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (kristaps@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.3/8.14.3) with ESMTP id p5LNbR4M012854 for ; Tue, 21 Jun 2011 19:37:28 -0400 (EDT) Received: (from kristaps@localhost) by krisdoz.my.domain (8.14.3/8.14.3/Submit) id p5LNbRnV003482; Tue, 21 Jun 2011 19:37:27 -0400 (EDT) Date: Tue, 21 Jun 2011 19:37:27 -0400 (EDT) Message-Id: <201106212337.p5LNbRnV003482@krisdoz.my.domain> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: kristaps@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: Fix broken transfer from hashtable to btree for makewhatis.c. X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- Fix broken transfer from hashtable to btree for makewhatis.c. Modified Files: -------------- mdocml: makewhatis.c Revision Data ------------- Index: makewhatis.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/makewhatis.c,v retrieving revision 1.6 retrieving revision 1.7 diff -Lmakewhatis.c -Lmakewhatis.c -u -p -r1.6 -r1.7 --- makewhatis.c +++ makewhatis.c @@ -416,16 +416,17 @@ main(int argc, char *argv[]) seq = R_FIRST; while (0 == (ch = (*hash->seq)(hash, &key, &val, seq))) { + seq = R_NEXT; + memcpy(vbuf, val.data, sizeof(uint32_t)); val.size = sizeof(vbuf); val.data = vbuf; + dbt_put(db, fbbuf, &key, &val); - if ((*hash->del)(hash, &key, 0) < 0) { - perror("hash"); - exit((int)MANDOCLEVEL_SYSERR); - } - seq = R_NEXT; + ch = (*hash->del)(hash, &key, R_CURSOR); + if (ch < 0) + break; } if (ch < 0) { @@ -746,11 +747,12 @@ hash_put(DB *db, const struct buf *buf, DBT key, val; int rc; - key.data = buf->cp; - - if ((key.size = buf->len) < 2) + if (buf->len < 2) return; + key.data = buf->cp; + key.size = buf->len; + if ((rc = (*db->get)(db, &key, &val, 0)) < 0) { perror("hash"); exit((int)MANDOCLEVEL_SYSERR); @@ -759,9 +761,6 @@ hash_put(DB *db, const struct buf *buf, val.data = &mask; val.size = sizeof(int); - - /*fprintf(stderr, "Hashing: [%s] (0x%x)\n", - (char *)key.data, mask);*/ if ((rc = (*db->put)(db, &key, &val, 0)) < 0) { perror("hash"); -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv