diff options
author | Andrew Morton <akpm@osdl.org> | 2004-02-03 18:32:36 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@home.osdl.org> | 2004-02-03 18:32:36 -0800 |
commit | c545699aca137204c9e435f2be70cda0723c92c5 (patch) | |
tree | 77ded8e1d87dea53191cd0cb3492899276e0b3be /lib | |
parent | d75cb1840b2c95fcfa740a9e6b350ae44c9fbb46 (diff) | |
download | history-c545699aca137204c9e435f2be70cda0723c92c5.tar.gz |
[PATCH] string fixes for gcc 3.4
From: Andi Kleen <ak@muc.de>
gcc 3.4 optimizes sprintf(foo,"%s",string) into strcpy. Unfortunately that
isn't seen by the inliner and linux/i386 has no out-of-line strcpy so you
end up with a linker error.
This patch adds out of line copies for most string functions to avoid this.
Actually it doesn't export them to modules yet, that would be the next
step.
BTW In my opinion we shouldn't use inline string functions at all. The
__builtin_str* in modern gcc are better (I used them very successfully on
x86-64) and for the bigger functions like strrchr,strtok et.al. it just
doesn't make any sense to inline them or even code them in assembler.
Also fix the bcopy prototype gcc was complaining about.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/string.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/string.c b/lib/string.c index 3ba8cabedf84f4..e660de079a5763 100644 --- a/lib/string.c +++ b/lib/string.c @@ -18,6 +18,8 @@ * Matthew Hawkins <matt@mh.dropbear.id.au> * - Kissed strtok() goodbye */ + +#define IN_STRING_C 1 #include <linux/types.h> #include <linux/string.h> @@ -437,12 +439,13 @@ void * memset(void * s,int c,size_t count) * You should not use this function to access IO space, use memcpy_toio() * or memcpy_fromio() instead. */ -void bcopy(const char * src, char * dest, int count) +void bcopy(const void * srcp, void * destp, size_t count) { - char *tmp = dest; + const char *src = srcp; + char *dest = destp; while (count--) - *tmp++ = *src++; + *dest++ = *src++; } #endif |