Skip to content

Commit

Permalink
[PATCH] lib/string.c cleanup: remove pointless register keyword
Browse files Browse the repository at this point in the history
Removes a few pointless register keywords.  register is merely a compiler
hint that access to the variable should be optimized, but gcc (3.3.6 in my
case) generates the exact same code with and without the keyword, and even
if gcc did something different with register present I think it is doubtful
we would want to optimize access to these variables - especially since this
is generic library code and there are supposed to be optimized versions in
asm/ for anything that really matters speed wise.

(akpm: iirc, keyword register is a gcc no-op unless using -O0)

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Jesper Juhl authored and Linus Torvalds committed Oct 31, 2005
1 parent 51a0f0f commit cc75fb7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ EXPORT_SYMBOL(strlcat);
#undef strcmp
int strcmp(const char *cs, const char *ct)
{
register signed char __res;
signed char __res;

while (1) {
if ((__res = *cs - *ct++) != 0 || !*cs++)
Expand All @@ -239,7 +239,7 @@ EXPORT_SYMBOL(strcmp);
*/
int strncmp(const char *cs, const char *ct, size_t count)
{
register signed char __res = 0;
signed char __res = 0;

while (count) {
if ((__res = *cs - *ct++) != 0 || !*cs++)
Expand Down

0 comments on commit cc75fb7

Please sign in to comment.