From 4016da6ca25a7980eaae35e2277ad91cbf5eac26 Mon Sep 17 00:00:00 2001 From: "terry%mozilla.org" Date: Thu, 22 Jul 1999 19:58:11 +0000 Subject: [PATCH] Make sure to recreate the database files from scratch every time. It used to merge old entries in with the stuff we recalculate. --- webtools/lxr/genxref | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/webtools/lxr/genxref b/webtools/lxr/genxref index 35ab3b0a2fc2..a5b0c080c7e9 100755 --- a/webtools/lxr/genxref +++ b/webtools/lxr/genxref @@ -1,5 +1,5 @@ #!/usr/bonsaitools/bin/perl -# $Id: genxref,v 1.4 1999/04/26 19:52:55 endico%mozilla.org Exp $ +# $Id: genxref,v 1.5 1999/07/22 19:58:11 terry%mozilla.org Exp $ # genxref.pl -- Finds identifiers in a set of C files using an # extremely fuzzy algorithm. It sort of works. @@ -361,7 +361,7 @@ sub dumpdb { print(STDERR "Starting pass 3: Dump database to disk.\n"); $start = time; - tie (%xrefdb, "DB_File" , "xref", O_RDWR|O_CREAT, 0664, $DB_HASH) + tie (%xrefdb, "DB_File" , "xref.out.$$", O_RDWR|O_CREAT, 0664, $DB_HASH) || die("Could not open \"xref\" for writing"); $i = 0; @@ -375,14 +375,16 @@ sub dumpdb { } untie(%xrefdb); + rename("xref.out.$$", "xref") || die "Couldn't rename xref.out.$$ to xref"; print(STDERR "Completed pass 3 (",(time-$start),"s):", "Information on $i identifiers dumped to disk.\n\n"); } -tie (%fileidx, "DB_File", "fileidx", O_RDWR|O_CREAT, 0660, $DB_HASH) - || die("Could not open \"fileidx\" for writing"); +tie (%fileidx, "DB_File", "fileidx.out.$$", O_RDWR|O_CREAT, 0660, $DB_HASH) + || die("Could not open \"fileidx.out.$$\" for writing"); + open(FILES, "find $realpath -print |"); while () { @@ -405,3 +407,5 @@ close(FILES); dbmclose(%fileidx); +rename("fileidx.out.$$", "fileidx") + || die "Couldn't rename fileidx.out.$$ to fileidx";