<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/lib/string.c, branch v3.3.4</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.3.4</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.3.4'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2011-11-01T00:30:56Z</updated>
<entry>
<title>lib/string.c: fix strim() semantics for strings that have only blanks</title>
<updated>2011-11-01T00:30:56Z</updated>
<author>
<name>Michael Holzheu</name>
<email>holzheu@linux.vnet.ibm.com</email>
</author>
<published>2011-11-01T00:12:37Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=66f6958e69d8055277356d3cc2e7a1d734db1755'/>
<id>urn:sha1:66f6958e69d8055277356d3cc2e7a1d734db1755</id>
<content type='text'>
Commit 84c95c9acf0 ("string: on strstrip(), first remove leading spaces
before running over str") improved 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: "   " -&gt; ""    (empty string)
After patch:  "   " -&gt; "   " (no change)

I think we should remove your patch to restore the old behavior.

The description (lib/string.c):

 * Note that the first trailing whitespace is replaced with a %NUL-terminator

=&gt; The first trailing whitespace of a string that only has whitespace
   characters is the first whitespace

The patch restores the old strim() semantics.

Signed-off-by: Michael Holzheu &lt;holzheu@linux.vnet.ibm.com&gt;
Cc: Andre Goddard Rosa &lt;andre.goddard@gmail.com&gt;
Cc: Martin Schwidefsky &lt;schwidefsky@de.ibm.com&gt;
Cc: Heiko Carstens &lt;heiko.carstens@de.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>lib/string.c: introduce memchr_inv()</title>
<updated>2011-11-01T00:30:47Z</updated>
<author>
<name>Akinobu Mita</name>
<email>akinobu.mita@gmail.com</email>
</author>
<published>2011-11-01T00:08:07Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=798248206b59acc6e1238c778281419c041891a7'/>
<id>urn:sha1:798248206b59acc6e1238c778281419c041891a7</id>
<content type='text'>
memchr_inv() is mainly used to check whether the whole buffer is filled
with just a specified byte.

The function name and prototype are stolen from logfs and the
implementation is from SLUB.

Signed-off-by: Akinobu Mita &lt;akinobu.mita@gmail.com&gt;
Acked-by: Christoph Lameter &lt;cl@linux-foundation.org&gt;
Acked-by: Pekka Enberg &lt;penberg@kernel.org&gt;
Cc: Matt Mackall &lt;mpm@selenic.com&gt;
Acked-by: Joern Engel &lt;joern@logfs.org&gt;
Cc: Marcin Slusarz &lt;marcin.slusarz@gmail.com&gt;
Cc: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>Add a strtobool function matching semantics of existing in kernel equivalents</title>
<updated>2011-05-19T07:25:28Z</updated>
<author>
<name>Jonathan Cameron</name>
<email>jic23@cam.ac.uk</email>
</author>
<published>2011-04-19T11:43:45Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=d0f1fed29e6e73d9d17f4c91a5896a4ce3938d45'/>
<id>urn:sha1:d0f1fed29e6e73d9d17f4c91a5896a4ce3938d45</id>
<content type='text'>
This is a rename of the usr_strtobool proposal, which was a renamed,
relocated and fixed version of previous kstrtobool RFC

Signed-off-by: Jonathan Cameron &lt;jic23@cam.ac.uk&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
<entry>
<title>lib/string.c: simplify strnstr()</title>
<updated>2010-03-06T19:26:35Z</updated>
<author>
<name>André Goddard Rosa</name>
<email>andre.goddard@gmail.com</email>
</author>
<published>2010-03-05T21:43:12Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=d6a2eedfddcded92c8f9b0ac022a99c4134696b0'/>
<id>urn:sha1:d6a2eedfddcded92c8f9b0ac022a99c4134696b0</id>
<content type='text'>
Signed-off-by: André Goddard Rosa &lt;andre.goddard@gmail.com&gt;
Cc: Li Zefan &lt;lizf@cn.fujitsu.com&gt;
Cc: Joe Perches &lt;joe@perches.com&gt;
Cc: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>lib/string.c: simplify stricmp()</title>
<updated>2010-03-06T19:26:35Z</updated>
<author>
<name>André Goddard Rosa</name>
<email>andre.goddard@gmail.com</email>
</author>
<published>2010-03-05T21:43:11Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=a11d2b64e1f2556953120d516241243ea365f0ae'/>
<id>urn:sha1:a11d2b64e1f2556953120d516241243ea365f0ae</id>
<content type='text'>
Removes 32 bytes on core2 with gcc 4.4.1:
   text    data     bss     dec     hex filename
   3196       0       0    3196     c7c lib/string-BEFORE.o
   3164       0       0    3164     c5c lib/string-AFTER.o

Signed-off-by: André Goddard Rosa &lt;andre.goddard@gmail.com&gt;
Cc: Joe Perches &lt;joe@perches.com&gt;
Cc: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>lib: Introduce strnstr()</title>
<updated>2010-01-15T03:38:09Z</updated>
<author>
<name>Li Zefan</name>
<email>lizf@cn.fujitsu.com</email>
</author>
<published>2010-01-14T02:53:55Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=d5f1fb53353edc38da326445267c1df0c9676df2'/>
<id>urn:sha1:d5f1fb53353edc38da326445267c1df0c9676df2</id>
<content type='text'>
It differs strstr() in that it limits the length to be searched
in the first string.

Signed-off-by: Li Zefan &lt;lizf@cn.fujitsu.com&gt;
LKML-Reference: &lt;4B4E8743.6030805@cn.fujitsu.com&gt;
Acked-by: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>lib/string.c: fix kernel-doc warnings</title>
<updated>2009-12-22T22:17:55Z</updated>
<author>
<name>Randy Dunlap</name>
<email>randy.dunlap@oracle.com</email>
</author>
<published>2009-12-21T22:37:22Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=a6cd13f3c98d1d16213e3b61054b9c209d93f877'/>
<id>urn:sha1:a6cd13f3c98d1d16213e3b61054b9c209d93f877</id>
<content type='text'>
Fix kernel-doc warnings (@arg name) in string.c::skip_spaces().

  Warning(lib/string.c:347): No description found for parameter 'str'
  Warning(lib/string.c:347): Excess function parameter 's' description in 'skip_spaces'

Signed-off-by: Randy Dunlap &lt;randy.dunlap@oracle.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>Subject: Re: [PATCH] strstrip incorrectly marked __must_check</title>
<updated>2009-12-15T16:53:34Z</updated>
<author>
<name>KOSAKI Motohiro</name>
<email>kosaki.motohiro@jp.fujitsu.com</email>
</author>
<published>2009-12-15T02:01:15Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=ca54cb8c9eb38095dc420b73c6380ce1dbeb10fa'/>
<id>urn:sha1:ca54cb8c9eb38095dc420b73c6380ce1dbeb10fa</id>
<content type='text'>
Recently, We marked strstrip() as must_check.  because it was frequently
misused and it should be checked.  However, we found one exception.
scsi/ipr.c intentionally ignore return value of strstrip.  Because it
wishes to keep the whitespace at the beginning.

Thus we need to keep with and without checked whitespace trim function.
This patch adds a new strim() and changes ipr.c to use it.

[akpm@linux-foundation.org: coding-style fixes]
Suggested-by: Alan Cox &lt;alan@lxorguk.ukuu.org.uk&gt;
Signed-off-by: KOSAKI Motohiro &lt;kosaki.motohiro@jp.fujitsu.com&gt;
Cc: James Bottomley &lt;James.Bottomley@HansenPartnership.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>string: on strstrip(), first remove leading spaces before running over str</title>
<updated>2009-12-15T16:53:32Z</updated>
<author>
<name>André Goddard Rosa</name>
<email>andre.goddard@gmail.com</email>
</author>
<published>2009-12-15T02:01:04Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=84c95c9acf088c99d8793d78036b67faa5d0b851'/>
<id>urn:sha1:84c95c9acf088c99d8793d78036b67faa5d0b851</id>
<content type='text'>
... so that strlen() iterates over a smaller string comprising of the
remaining characters only.

Signed-off-by: André Goddard Rosa &lt;andre.goddard@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>string: factorize skip_spaces and export it to be generally available</title>
<updated>2009-12-15T16:53:32Z</updated>
<author>
<name>André Goddard Rosa</name>
<email>andre.goddard@gmail.com</email>
</author>
<published>2009-12-15T02:01:04Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f653398c86a1c104f0992bd788dd4bb065449be4'/>
<id>urn:sha1:f653398c86a1c104f0992bd788dd4bb065449be4</id>
<content type='text'>
On the following sentence:
    while (*s &amp;&amp; isspace(*s))
        s++;

If *s == 0, isspace() evaluates to ((_ctype[*s] &amp; 0x20) != 0), which
evaluates to ((0x08 &amp; 0x20) != 0) which equals to 0 as well.
If *s == 1, we depend on isspace() result anyway. In other words,
"a char equals zero is never a space", so remove this check.

Also, *s != 0 is most common case (non-null string).

Fixed const return as noticed by Jan Engelhardt and James Bottomley.
Fixed unnecessary extra cast on strstrip() as noticed by Jan Engelhardt.

Signed-off-by: André Goddard Rosa &lt;andre.goddard@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
