git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] C version of git-count-objects

From
PHPeter Hagervall <hager@cs.umu.se>
Date
Apr 27, 2006, 19:46 UTC
Message-ID
<20060427194559.GA26386@brainysmurf.cs.umu.se>
In-Reply-To
<Pine.LNX.4.64.0604271535460.18816@localhost.localdomain>
On Thu, Apr 27, 2006 at 03:39:14PM -0400, Nicolas Pitre wrote:
Show 31 quoted lines
> On Thu, 27 Apr 2006, Junio C Hamano wrote:
> 
> > Nicolas Pitre <nico@cam.org> writes:
> > 
> > > On Thu, 27 Apr 2006, Peter Hagervall wrote:
> > >
> > >> Answering the call Linus made[1], sort of, but for a completely
> > >> different program.
> > >> 
> > >> Anyway, it ought to be at least as portable as the shell script, and a
> > >> whole lot faster, however much that matters.
> > >> 
> > > [...]
> > >> +	for (i = 0; i < 16; i++) {
> > >> +		subdir[0] = hex_digits[i];
> > >> +		for (j = 0; j < 16; j++) {
> > >> +			subdir[1] = hex_digits[j];
> > >> +			if (access(subdir, R_OK | X_OK))
> > >> +				continue;
> > >> +			chdir(subdir);
> > >> +			if (!(dp = opendir("."))) {
> > >> +				error("can't open subdir %s", subdir);
> > >> +				continue;
> > >> +			}
> > >
> > > Looks like you're missing a chdir(".."); there.
> > 
> > Why would you even _need_ to chdir() anywhere, anyway?
> 
> To avoid appending the filename to the path before each lstat() I'd 
> guess.
Yes, that's pretty much the reason.
	Peter
Previous: Nicolas PitreNext: Linus Torvalds
Message 7 of 12 in “C version of git-count-objects”
  1. C version of git-count-objectsPeter Hagervall, Apr 27, 2006
  2. Morten WelinderApr 27, 2006
  3. Nicolas PitreApr 27, 2006
  4. C version of git-count-objects, second tryPeter Hagervall, Apr 27, 2006
  5. Junio C HamanoApr 27, 2006
  6. Nicolas PitreApr 27, 2006
  7. Peter HagervallApr 27, 2006
  8. Linus TorvaldsApr 27, 2006
  9. Peter HagervallApr 27, 2006
  10. Junio C HamanoApr 27, 2006
  11. Peter HagervallApr 28, 2006
  12. Junio C HamanoApr 28, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.