On Sat, May 31, 2014 at 08:21:31AM -0700, Pasha Bolokhov wrote:
> + char *p, *last_space = NULL;
> +
> + for (p = buf; *p; p++)
> + if (*p == ' ') {
> + if (!last_space)
> + last_space = p;
> + } else {
> +
Discard the unnecessary 'nr_spaces' variable, remove 'strlen()' and
improve the 'if' structure. Switch to pointers instead of integers
Slightly more rare occurrences of 'text \' with a backslash
in between spaces are handled correctly. Namely, the code in
8ba87adad6 does not reset 'last_space
Jeff King writes:
> On Thu, May 29, 2014 at 02:34:33PM -0700, Pasha Bolokhov wrote:
>
>> > However, I doubt it makes that much of a difference in practice, so
>> > unless it's measurable, I would certainly go with the version that is
>> > more readable (and correct, of course).
>>
>> Sorry,
On Thu, May 29, 2014 at 02:34:33PM -0700, Pasha Bolokhov wrote:
> > However, I doubt it makes that much of a difference in practice, so
> > unless it's measurable, I would certainly go with the version that is
> > more readable (and correct, of course).
>
> Sorry, just to recap, you would go
On Thu, May 29, 2014 at 1:13 PM, Jeff King wrote:
> On Wed, May 28, 2014 at 04:45:57PM -0700, Pasha Bolokhov wrote:
>
>> Move backwards from the end of the string (more efficient for
>> lines which do not have trailing spaces or have just a couple).
>
> The original code reads the string from left
On Wed, May 28, 2014 at 04:45:57PM -0700, Pasha Bolokhov wrote:
> Move backwards from the end of the string (more efficient for
> lines which do not have trailing spaces or have just a couple).
The original code reads the string from left to right. In theory, that
means we could get away with not
Move backwards from the end of the string (more efficient for
lines which do not have trailing spaces or have just a couple).
Slightly more rare occurrences of 'text \' with a backslash
in between spaces are handled correctly.
Namely, the code in 8ba87adad6 does not reset 'last_space' when
a b
7 matches
Mail list logo