nmh-workers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] [PATCH] Further simplify dodir/addir/addfold in uip/fo


From: Eric Gillespie
Subject: Re: [Nmh-workers] [PATCH] Further simplify dodir/addir/addfold in uip/folder.c
Date: Tue, 05 Aug 2008 12:23:01 -0700

Peter Maydell writes:

> Eric Gillespie wrote:
> >This depends on my previous patch to uip/folder.c, but I provide
> >them separately for ease of review.
> 
> Thanks -- I have applied both these patches to CVS.
> (I wasn't completely convinced about the way the first patch
> drops the handling in addir() of names starting "./", but I couldn't
> get it to misbehave, and I don't think it's actually possible to
> get such a name except when the name is the literal ".". Can
> you confirm that?)

Sure.  The old code was unconditionally overwriting name's
terminating null byte with "/" (without the bounds-checking used
later in the function; I guess no one has 8K (BUFSIZ) long folder
paths anyway ;-> but then why check later?) and then latter
appending child folder names to that, so:

addir(".")
  "./childA"
  "./childB"
addir("childB")
  "childB/childC"

So, nothing wrong with the second call, but the call that starts
it all (addir(".")) causes folder to prefix every folder with
"./".  The old code solved this with yet another pointer into
this buffer (I remember at least 3 of these).  Instead, I
conditionalized the prefix.

Does that make sense?

I had to step through this in gdb to figure out what it was
doing.  I got here because I'm going to pull this code out of
'folder' so that I can also use it in 'new'.  I should have
mentioned earlier that I confirmed that I got the same results
before and after my change from folder -all -fast -recur on both
work and personal folder hierarchies, and the memory allocation
is the same (confirmed with valgrind).

Thanks for the review and commit.

-- 
Eric Gillespie <*> address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]