source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Fix broken transfer from hashtable to btree for makewhatis.c.
@ 2011-06-21 23:37 kristaps
  0 siblings, 0 replies; only message in thread
From: kristaps @ 2011-06-21 23:37 UTC (permalink / raw)
  To: source

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-06-21 23:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-21 23:37 mdocml: Fix broken transfer from hashtable to btree for makewhatis.c kristaps

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).