add string.h
This commit is contained in:
parent
d0cbaba4d1
commit
c8db9fe905
26
src/string.h
Normal file
26
src/string.h
Normal file
@ -0,0 +1,26 @@
|
||||
#ifndef STRING_H
|
||||
#define STRING_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
static inline size_t strlen(const char * s)
|
||||
{
|
||||
size_t r = 0u;
|
||||
while (*s++ != (char)0)
|
||||
{
|
||||
r++;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
static inline char * strcpy(char * dest, const char * src)
|
||||
{
|
||||
return __builtin_strcpy(dest, src);
|
||||
}
|
||||
|
||||
static inline char * strncpy(char * dest, const char * src, size_t n)
|
||||
{
|
||||
return __builtin_strncpy(dest, src, n);
|
||||
}
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user