Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Apr 2003 01:30:03 -0700 (PDT)
From:      David Schultz <das@FreeBSD.ORG>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/51151: du hardlinkmatching is slow - fix included
Message-ID:  <200304200830.h3K8U3x3097536@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/51151; it has been noted by GNATS.

From: David Schultz <das@FreeBSD.ORG>
To: Peter van Dijk <peter@dataloss.nl>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/51151: du hardlinkmatching is slow - fix included
Date: Sun, 20 Apr 2003 01:27:24 -0700

 On Sat, Apr 19, 2003, Peter van Dijk wrote:
 > +	snprintf(s, 32, "%u:%u", dev, ino);
 > +
 > +	if(tree_srch(&linktree, strcmp, s)==0)
 > +	{
 > +		tree_add(&linktree, strcmp, s, 0);
 > +		return(0);
 > +	}
 > +	else
 > +	{
 > +		free(s);
 > +		return(1);
 > +	}
 
 A hash table would be more appropriate here.  You could even
 preserve the original behavior of making infrequent calls to
 malloc() and most of the original code by using open addressing.
 In any case, pulling in another library is probably not desirable.
 
 If you would like to revise this patch, I would be happy to help
 you get it committed.  You might also want to take a look at
 style(9).



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200304200830.h3K8U3x3097536>