History

[PATCH] lib/string.c cleanup: remove pointless register keyword

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)

Jesper Juhl committed 21 years ago

Commit cc75fb71 parent 51a0f0f1 file · +2 −2Browse files

Showing the changes to lib/string.c (1 of 1 file). Show all

Unified · Split

lib/string.c+2−2
@@ -219,7 +219,7 @@ EXPORT_SYMBOL(strlcat); · 218 unmodified lines
219#undef strcmp219#undef strcmp
220int strcmp(const char *cs, const char *ct)220int strcmp(const char *cs, const char *ct)
221{221{
222 register signed char __res;222 signed char __res;
223 223
224 while (1) {224 while (1) {
225 if ((__res = *cs - *ct++) != 0 || !*cs++)225 if ((__res = *cs - *ct++) != 0 || !*cs++)
@@ -239,7 +239,7 @@ EXPORT_SYMBOL(strcmp); · 13 unmodified lines
239 */239 */
240int strncmp(const char *cs, const char *ct, size_t count)240int strncmp(const char *cs, const char *ct, size_t count)
241{241{
242 register signed char __res = 0;242 signed char __res = 0;
243 243
244 while (count) {244 while (count) {
245 if ((__res = *cs - *ct++) != 0 || !*cs++)245 if ((__res = *cs - *ct++) != 0 || !*cs++)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t