diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2009-04-18 16:59:47 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2009-04-18 16:59:47 -0400 |
commit | 38d1a349271731f100f0e4b3daa10cf601892591 (patch) | |
tree | 387ce1c804c73b2e7199b6d71cec9615e6cf917c /src | |
parent | 425f212760fe8be280aa11891407ba5339055891 (diff) | |
download | seabios-38d1a349271731f100f0e4b3daa10cf601892591.tar.gz |
Replace memeq/streq functions with memcmp/strcmp.
The standard functions are better known and not harder to implement.
Diffstat (limited to 'src')
-rw-r--r-- | src/cdrom.c | 2 | ||||
-rw-r--r-- | src/coreboot.c | 4 | ||||
-rw-r--r-- | src/util.c | 12 | ||||
-rw-r--r-- | src/util.h | 4 |
4 files changed, 11 insertions, 11 deletions
diff --git a/src/cdrom.c b/src/cdrom.c index 71a8b849..8f9e7d0a 100644 --- a/src/cdrom.c +++ b/src/cdrom.c @@ -417,7 +417,7 @@ cdrom_boot(int cdid) // Validity checks if (buffer[0]) return 4; - if (!streq((char*)&buffer[1], "CD001\001EL TORITO SPECIFICATION")) + if (strcmp((char*)&buffer[1], "CD001\001EL TORITO SPECIFICATION") != 0) return 5; // ok, now we calculate the Boot catalog address diff --git a/src/coreboot.c b/src/coreboot.c index feccad35..cdb13ba5 100644 --- a/src/coreboot.c +++ b/src/coreboot.c @@ -362,7 +362,7 @@ cbfs_findfile(const char *fname) struct cbfs_file *file; for (file = cbfs_getfirst(); file; file = cbfs_getnext(file)) { dprintf(3, "Found CBFS file %s\n", file->filename); - if (streq(fname, file->filename)) + if (strcmp(fname, file->filename) == 0) return file; } return NULL; @@ -379,7 +379,7 @@ cbfs_findNprefix(const char *prefix, int n) struct cbfs_file *file; for (file = cbfs_getfirst(); file; file = cbfs_getnext(file)) { dprintf(3, "Found CBFS file %s\n", file->filename); - if (memeq(prefix, file->filename, len)) { + if (memcmp(prefix, file->filename, len) == 0) { if (n <= 0) return file->filename; n--; @@ -132,27 +132,27 @@ strlen(const char *s) // Compare two areas of memory. int -memeq(const void *s1, const void *s2, size_t n) +memcmp(const void *s1, const void *s2, size_t n) { while (n) { if (*(u8*)s1 != *(u8*)s2) - return 0; + return *(u8*)s1 < *(u8*)s2 ? -1 : 1; s1++; s2++; n--; } - return 1; + return 0; } // Compare two strings. int -streq(const char *s1, const char *s2) +strcmp(const char *s1, const char *s2) { for (;;) { if (*s1 != *s2) - return 0; + return *s1 < *s2 ? -1 : 1; if (! *s1) - return 1; + return 0; s1++; s2++; } @@ -69,9 +69,9 @@ static inline u64 rdtscll(void) inline u32 stack_hop(u32 eax, u32 edx, u32 ecx, void *func); u8 checksum_far(u16 buf_seg, void *buf_far, u32 len); u8 checksum(void *buf, u32 len); -int memeq(const void *s1, const void *s2, size_t n); +int memcmp(const void *s1, const void *s2, size_t n); size_t strlen(const char *s); -int streq(const char *s1, const char *s2); +int strcmp(const char *s1, const char *s2); void *memset(void *s, int c, size_t n); void *memcpy(void *d1, const void *s1, size_t len); inline void memcpy_far(u16 d_seg, void *d_far |