Commit b4cf974a authored by Antonio Nino Diaz's avatar Antonio Nino Diaz
Browse files

libc: Adapt strlcpy to this codebase



Change-Id: I2f5f64aaf90caae936510e1179392a8835f493e0
Signed-off-by: default avatarAntonio Nino Diaz <antonio.ninodiaz@arm.com>
parent b3e9214e
...@@ -28,5 +28,6 @@ void *memset(void *dst, int val, size_t count); ...@@ -28,5 +28,6 @@ void *memset(void *dst, int val, size_t count);
size_t strlen(const char *s); size_t strlen(const char *s);
size_t strnlen(const char *s, size_t maxlen); size_t strnlen(const char *s, size_t maxlen);
char *strrchr(const char *p, int ch); char *strrchr(const char *p, int ch);
size_t strlcpy(char * dst, const char * src, size_t dsize);
#endif /* STRING_H */ #endif /* STRING_H */
...@@ -19,6 +19,7 @@ LIBC_SRCS := $(addprefix lib/libc/, \ ...@@ -19,6 +19,7 @@ LIBC_SRCS := $(addprefix lib/libc/, \
snprintf.c \ snprintf.c \
strchr.c \ strchr.c \
strcmp.c \ strcmp.c \
strlcpy.c \
strlen.c \ strlen.c \
strncmp.c \ strncmp.c \
strnlen.c \ strnlen.c \
......
/* $OpenBSD: strlcpy.c,v 1.12 2015/01/15 03:54:12 millert Exp $ */ /* $OpenBSD: strlcpy.c,v 1.12 2015/01/15 03:54:12 millert Exp $ */
/* /*
* SPDX-License-Identifier: ISC
*
* Copyright (c) 1998, 2015 Todd C. Miller <Todd.Miller@courtesan.com> * Copyright (c) 1998, 2015 Todd C. Miller <Todd.Miller@courtesan.com>
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
...@@ -16,10 +18,7 @@ ...@@ -16,10 +18,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
#include <sys/cdefs.h> #include <stdint.h>
__FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <string.h> #include <string.h>
/* /*
...@@ -28,7 +27,7 @@ __FBSDID("$FreeBSD$"); ...@@ -28,7 +27,7 @@ __FBSDID("$FreeBSD$");
* Returns strlen(src); if retval >= dsize, truncation occurred. * Returns strlen(src); if retval >= dsize, truncation occurred.
*/ */
size_t size_t
strlcpy(char * __restrict dst, const char * __restrict src, size_t dsize) strlcpy(char * dst, const char * src, size_t dsize)
{ {
const char *osrc = src; const char *osrc = src;
size_t nleft = dsize; size_t nleft = dsize;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment