1 //-----------------------------------------------------------------------------
2 // Jonathan Westhues, Sept 2005
4 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
5 // at your option, any later version. See the LICENSE.txt file for the text of
7 //-----------------------------------------------------------------------------
8 // Common string.h functions
9 //-----------------------------------------------------------------------------
14 void *memcpy(void *dest
, const void *src
, size_t len
) {
16 const uint8_t *s
= src
;
26 void *memset(void *dest
, int c
, size_t len
) {
36 void *memmove(void *dest
, const void *src
, size_t len
) {
38 const uint8_t *s
= src
;
58 int memcmp(const void *av
, const void *bv
, size_t len
) {
59 const uint8_t *a
= av
;
60 const uint8_t *b
= bv
;
73 size_t strlen(const char *str
) {
83 char* strncat(char *dest
, const char *src
, size_t n
) {
84 unsigned int dest_len
= strlen(dest
);
87 for (i
= 0 ; i
< n
&& src
[i
] != '\0' ; i
++)
88 dest
[dest_len
+ i
] = src
[i
];
89 dest
[dest_len
+ i
] = '\0';
95 char* strcat(char *dest
, const char *src
) {
96 unsigned int dest_len
= strlen(dest
);
99 for (i
= 0 ; src
[i
] != '\0' ; i
++)
100 dest
[dest_len
+ i
] = src
[i
];
101 dest
[dest_len
+ i
] = '\0';