lib/string.c: improve strrchr()
authorRasmus Villemoes <[email protected]>
Fri, 13 Feb 2015 22:36:44 +0000 (14:36 -0800)
committerLinus Torvalds <[email protected]>
Sat, 14 Feb 2015 05:21:36 +0000 (21:21 -0800)
commit8da53d4595a53fb9a3380dd4d1c9bc24c7c9aab8
tree82207634de679fd96287b82ecb9bb5da205a8c2a
parentfcc139ae227b97bd81352e9102d8e79498d1e930
lib/string.c: improve strrchr()

Instead of potentially passing over the string twice in case c is not
found, just keep track of the last occurrence.  According to
bloat-o-meter, this also cuts the generated code by a third (54 vs 36
bytes).  Oh, and we get rid of those 7-space indented lines.

Signed-off-by: Rasmus Villemoes <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
lib/string.c