Fix signedness problem in memcmp.

Signed-off-by: Ulf Jordan <jordan@chalmers.se>
Acked-by: Peter Stuge <peter@stuge.se>


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3491 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Ulf Jordan 2008-08-09 19:34:56 +00:00 committed by Peter Stuge
parent f1e127472b
commit 68285699da
2 changed files with 3 additions and 3 deletions

View File

@ -178,7 +178,7 @@ u8 hex2bin(u8 h);
void *memset(void *s, int c, size_t n);
void *memcpy(void *dst, const void *src, size_t n);
void *memmove(void *dst, const void *src, size_t n);
int memcmp(const char *s1, const char *s2, size_t len);
int memcmp(const void *s1, const void *s2, size_t len);
/* libc/printf.c */
int snprintf(char *str, size_t size, const char *fmt, ...);

View File

@ -107,8 +107,8 @@ void *memmove(void *dst, const void *src, size_t n)
* @return If len is 0, return zero. If the areas match, return zero.
* Otherwise return non-zero.
*/
int memcmp(const char *s1, const char *s2, size_t len)
int memcmp(const void *s1, const void *s2, size_t len)
{
for (; len && *s1++ == *s2++; len--) ;
for (; len && *(char *)s1++ == *(char *)s2++; len--) ;
return len;
}