use btree access method, not recno access method, so garbage collection
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Tue, 1 Jun 1993 04:57:39 +0000 (20:57 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Tue, 1 Jun 1993 04:57:39 +0000 (20:57 -0800)
works -- from Rodney for 4.4BSD

SCCS-vsn: contrib/ed/d.c 5.5
SCCS-vsn: contrib/ed/e.c 5.8

usr/src/contrib/ed/d.c
usr/src/contrib/ed/e.c

index 47f111a..2cc3953 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)d.c        5.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)d.c        5.5 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/types.h>
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -153,6 +153,9 @@ d_do()
                        /* no garbage collection done currently */
 #endif
 #ifdef DBI
                        /* no garbage collection done currently */
 #endif
 #ifdef DBI
+                       /* garbage collection should be done iff the
+                        * open was done as btree, not recno.
+                        */
                        l_db_key.size = sizeof(recno_t);
                        l_db_key.data = &(l_temp2->handle);
                        (dbhtmp->del) (dbhtmp, &l_db_key, (u_int) 0);
                        l_db_key.size = sizeof(recno_t);
                        l_db_key.data = &(l_temp2->handle);
                        (dbhtmp->del) (dbhtmp, &l_db_key, (u_int) 0);
index 291df11..ecfa4e3 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)e.c        5.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)e.c        5.8 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/types.h>
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -115,9 +115,6 @@ e2(inputt, errnum)
        int *errnum;
 {
        char *tmp_path;
        int *errnum;
 {
        char *tmp_path;
-#ifdef DBI
-       RECNOINFO l_dbaccess;
-#endif
 
        sigspecial++;
 #ifndef MEMORY
 
        sigspecial++;
 #ifndef MEMORY
@@ -140,17 +137,12 @@ e2(inputt, errnum)
        file_seek = 0;
 #endif
 #ifdef DBI
        file_seek = 0;
 #endif
 #ifdef DBI
-/*
-       (l_dbaccess.bval) = (u_char) '\0';
-       (l_dbaccess.cachesize) = 0;
-       (l_dbaccess.flags) = R_NOKEY;
-       (l_dbaccess.lorder) = 0;
-       (l_dbaccess.reclen) = 0;
-       dbhtmp = dbopen(template, O_CREAT | O_RDWR,
-           S_IRUSR | S_IWUSR, (DBTYPE) DB_RECNO, &l_dbaccess);
-*/
+       /* open using btree only, recno will mess things up
+        * because of garbage collection and how recno operates
+        * with delete.
+        */
        dbhtmp = dbopen(template, O_CREAT | O_RDWR,
        dbhtmp = dbopen(template, O_CREAT | O_RDWR,
-           S_IRUSR | S_IWUSR, (DBTYPE) DB_RECNO, NULL);
+           S_IRUSR | S_IWUSR, (DBTYPE) DB_BTREE, NULL);
        if (dbhtmp == NULL) {
                ed_exit(5); /* unable to create buffer */
        }
        if (dbhtmp == NULL) {
                ed_exit(5); /* unable to create buffer */
        }