lkml.org 
[lkml]   [2011]   [Oct]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] Fix strim() semantics for strings that have only blanks
Hello Michael,

On Thu, Oct 13, 2011 at 8:54 PM, Andrew Morton
<akpm@linux-foundation.org> wrote:
> On Wed, 12 Oct 2011 10:31:57 +0200
> Michael Holzheu <holzheu@linux.vnet.ibm.com> wrote:
>
>> Hello Andre,
>>
>> With git commit 84c95c9acf088c99d8793d78036b67faa5d0b851 a patch from
>> you went upstream where you wanted to improve the performance of the
>> strim() function.
>>
>> Unfortunately this changed the semantics of strim() and broke my code. Before
>> the patch it was possible to use strim() without using the return value for
>> removing trailing spaces from strings that had either only blanks or only
>> trailing blanks.
>>
>> Now this does not work any longer for strings that *only* have blanks.
>>
>> Before patch: "   " -> ""    (empty string)
>> After patch:  "   " -> "   " (no change)
>>
>> I think we should remove your patch to restore the old behavior.
>>
>> >From the description (lib/string.c):
>>
>>  * Note that the first trailing whitespace is replaced with a %NUL-terminator
>>
>> => The first trailing whitespace of a string that only has whitespace
>>    characters is the first whitespace
>
> Yes, that change makes sense.

breaking your code was not good at all. Is it maintained off tree?
I believe It happened because you use strim() without using its return.
In any case, I'm OK on reverting it to fix your problem.

Thanks,
André
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2011-10-17 13:27    [W:0.081 / U:0.764 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site