bug-coreutils
[Top][All Lists]
Advanced

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

Re: sort "b" option in pos2 has strange effect


From: Jim Meyering
Subject: Re: sort "b" option in pos2 has strange effect
Date: Thu, 26 Feb 2009 14:59:19 +0100

Pádraig Brady wrote:
...
>>> -  /* If we're ignoring leading blanks when computing the End
>>> -     of the field, don't start counting bytes until after skipping
>>> -     past any leading blanks. */
>>> -  if (key->skipeblanks)
>>> -    while (ptr < lim && blanks[to_uchar (*ptr)])
>>> -      ++ptr;
>>> +  if (echar != 0) /* We need to skip over a portion of the end field.  */
>>> +    {
>>> +      if (key->skipeblanks) /* blanks not counted in echar.  */
>>
>> Was something wrong with the comment you're removing, above?
>
> I thought it was too verbose. It's replaced with:
>   /* blanks not counted in echar.  */
> which should be obvious in along with the code?

In that case, please stick with the longer comment.
Not only is it a complete sentence (which we prefer),
but I find it more readable/descriptive.

>>> +   while (ptr < lim && blanks[to_uchar (*ptr)])
>>> +     ++ptr;
>>>
>>> -  /* Advance PTR by ECHAR (if possible), but no further than LIM.  */
>>> -  remaining_bytes = lim - ptr;
>>> -  if (echar < remaining_bytes)
>>> -    ptr += echar;
>>> -  else
>>> -    ptr = lim;
>>> +      ptr = MIN (lim, ptr + echar);
>>> +    }
>
> Same here. I removed the comment as the code is (now) obvious I think.

Removing that one is ok, I suppose.
But in general, please try to add rather than remove comments.




reply via email to

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