mirror of
https://github.com/ipxe/ipxe
synced 2026-01-13 00:48:39 +03:00
[libc] Rewrite string functions
Some of the C library string functions have an unknown provenance. Reimplement all such functions to avoid potential licensing uncertainty. Remove the inline-assembler versions of strlen(), memswap(), and strncmp(); these save a minimal amount of space (around 40 bytes in total) and are not performance-critical. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -28,8 +28,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
||||
*
|
||||
*/
|
||||
|
||||
#define __HAVE_ARCH_MEMCPY
|
||||
|
||||
extern void * __memcpy ( void *dest, const void *src, size_t len );
|
||||
extern void * __memcpy_reverse ( void *dest, const void *src, size_t len );
|
||||
|
||||
@@ -169,8 +167,6 @@ memcpy ( void *dest, const void *src, size_t len ) {
|
||||
}
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_MEMMOVE
|
||||
|
||||
extern void * __memmove ( void *dest, const void *src, size_t len );
|
||||
|
||||
/**
|
||||
@@ -196,8 +192,6 @@ memmove ( void *dest, const void *src, size_t len ) {
|
||||
}
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_MEMSET
|
||||
|
||||
/**
|
||||
* Fill memory region
|
||||
*
|
||||
@@ -217,16 +211,4 @@ static inline void * memset ( void *dest, int fill, size_t len ) {
|
||||
return dest;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_MEMSWAP
|
||||
|
||||
extern void * memswap ( void *dest, void *src, size_t len );
|
||||
|
||||
#define __HAVE_ARCH_STRNCMP
|
||||
|
||||
extern int strncmp ( const char *str1, const char *str2, size_t len );
|
||||
|
||||
#define __HAVE_ARCH_STRLEN
|
||||
|
||||
extern size_t strlen ( const char *string );
|
||||
|
||||
#endif /* X86_BITS_STRING_H */
|
||||
|
||||
Reference in New Issue
Block a user