Re: [PATCH 3/3] pretty=format: Avoid some expensive calculations when not needed

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Pierre Habouzit
Date: Wednesday, November 7, 2007 - 4:31 pm

On Wed, Nov 07, 2007 at 11:21:30PM +0000, Ren=C3=A9 Scharfe wrote:
re.

  Yes, strchrnul is _very_ useful for parsing.


Well you can alternatively write it this way of course:

for (;;) {
    const char *percent =3D strchrnul(fmt, '%');
    strbuf_add(sb, fmt, percent - fmt);
    if (!*percent)
        break /* or return probably */;
    fmt =3D percent + 1;

    /* do your stuff */
}

--=20
=C2=B7O=C2=B7  Pierre Habouzit
=C2=B7=C2=B7O                                                madcoder@debia=
n.org
OOO                                                http://www.madism.org
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/3] Make user formatted commit listing less expensive, Johannes Schindelin, (Sun Nov 4, 12:14 pm)
[PATCH 1/3] Split off the pretty print stuff into its own file, Johannes Schindelin, (Sun Nov 4, 12:15 pm)
[PATCH 2/3] interpolate.[ch]: Add a function to find which ..., Johannes Schindelin, (Sun Nov 4, 12:15 pm)
[PATCH 3/3] pretty=format: Avoid some expensive calculatio ..., Johannes Schindelin, (Sun Nov 4, 12:15 pm)
Re: [PATCH 3/3] pretty=format: Avoid some expensive calcul ..., Johannes Schindelin, (Mon Nov 5, 4:53 pm)
Re: [PATCH 3/3] pretty=format: Avoid some expensive calcul ..., Johannes Schindelin, (Tue Nov 6, 4:36 pm)
[PATCH 1/2] interpolate.[ch]: Add a function to find which ..., Johannes Schindelin, (Tue Nov 6, 4:38 pm)
[PATCH 2/2] pretty=format: Avoid some expensive calculatio ..., Johannes Schindelin, (Tue Nov 6, 4:38 pm)
Re: [PATCH 3/3] pretty=format: Avoid some expensive calcul ..., Johannes Schindelin, (Tue Nov 6, 4:45 pm)
Re: [PATCH 3/3] pretty=format: Avoid some expensive calcul ..., Pierre Habouzit, (Wed Nov 7, 4:31 pm)
Re: [PATCH 3/3] pretty=format: Avoid some expensive calcul ..., Johannes Schindelin, (Wed Nov 7, 5:14 pm)