mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-12 06:22:56 +02:00
nvmutil: remove memcmp/memcpy/strrchr/rename
i had this idea in my head of later porting this to k&r c for fun. but screw it. compiling on everything since 1989 is enough Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -81,43 +81,3 @@ xstrxlen(const char *scmp, unsigned long maxlen)
|
||||
|
||||
return xstr_index;
|
||||
}
|
||||
|
||||
char *
|
||||
x_c_strrchr(const char *s, int c)
|
||||
{
|
||||
const char *p = NULL;
|
||||
|
||||
for ( ; *s; s++)
|
||||
if (*s == (char)c)
|
||||
p = s;
|
||||
|
||||
if (c == '\0')
|
||||
return (char *)s;
|
||||
|
||||
return (char *)p;
|
||||
}
|
||||
|
||||
void *
|
||||
x_v_memcpy(void *dst, const void *src, unsigned long n)
|
||||
{
|
||||
unsigned char *d = (unsigned char *)dst;
|
||||
const unsigned char *s = (const unsigned char *)src;
|
||||
|
||||
while (n--)
|
||||
*d++ = *s++;
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
int
|
||||
x_i_memcmp(const void *a, const void *b, unsigned long n)
|
||||
{
|
||||
const unsigned char *pa = (const unsigned char *)a;
|
||||
const unsigned char *pb = (const unsigned char *)b;
|
||||
|
||||
for ( ; n--; ++pa, ++pb)
|
||||
if (*pa != *pb)
|
||||
return *pa - *pb;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user