[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Add -p to show C function names was Re: [PATCH] Extra options for libsvn_diff

From: Stefan Sperling <stsp_at_elego.de>
Date: 2007-12-28 13:50:09 CET

On Wed, Dec 26, 2007 at 01:47:17PM -0800, Justin Erenkrantz wrote:
> On Dec 26, 2007 1:40 PM, David Glasser <glasser@davidglasser.net> wrote:
> > On Dec 26, 2007 11:30 AM, Justin Erenkrantz <justin@erenkrantz.com> wrote:
> > > I'd like to resurrect this discussion - IOW, I want Subversion to
> > > support -p out-of-the-box to print C-style function names.
> >
> > Agreed. I always use --diff-cmd diff -x -up for this reason (and wish
> > that the svn.collab.net commit mails did as well, though that's an
> > orthogonal issue).
> >
> > I think it would be reasonable to make svn's implementation compatible
> > with GNU diff's, though; the regexp it uses is /^[[:alpha:]$_]/,
> > whereas the patch is essentially /^[[:alpha:]0-9]/.
>
> Calling it a regex is being generous. The patch just calls:
>
> && svn_ctype_isalnum(*curp))
>
> Perhaps, we could improve it to:
>
> && (svn_ctype_isalpha(*curp) || *curp == '$' || *curp == '_')

Just mentioning that this is what OpenBSD's diff does as well.

And they also consider some C++/Java keywords which seems nice.
I guess a whole lot of Java people using subversion would
appreciate this, too.

if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') {
        if (begins_with(buf, "private:")) {
                if (!state)
                        state = " (private)";
        } else if (begins_with(buf, "protected:")) {
                if (!state)
                        state = " (protected)";
        } else if (begins_with(buf, "public:")) {
                if (!state)
                        state = " (public)";
        } else {
                strlcpy(lastbuf, buf, sizeof lastbuf);
                if (state)
                        strlcat(lastbuf, state,
                            sizeof lastbuf);
                lastmatchline = pos;
                return lastbuf;
        }
}

Full context here, look for the match_function() function:
http://www.openbsd.org/cgi-bin/cvsweb/~checkout~/src/usr.bin/diff/diffreg.c?rev=1.70&content-type=text/plain

-- 
Stefan Sperling <stsp@elego.de>                 Software Developer
elego Software Solutions GmbH                            HRB 77719
Gustav-Meyer-Allee 25, Gebaeude 12        Tel:  +49 30 23 45 86 96 
13355 Berlin                              Fax:  +49 30 23 45 86 95
http://www.elego.de                 Geschaeftsfuehrer: Olaf Wagner

  • application/pgp-signature attachment: stored
Received on Fri Dec 28 13:50:13 2007

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.