Skip to content
Snippets Groups Projects
Commit 78ae0fd8 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Change spaces to tabs in new strlcpy()

parent 5780e693
Branches
Tags
1 merge request!455Update branch with changes from master
Pipeline #6265 failed
......@@ -69,26 +69,26 @@ int safe_snprintf(char *dst, size_t size, const char *fmt, ...)
#ifdef NEEDS_STRLCPY
size_t strlcpy(char *dst, const char *src, size_t dsize)
{
const char *osrc = src;
size_t nleft = dsize;
/* Copy as many bytes as will fit. */
if (nleft != 0) {
while (--nleft != 0) {
if ((*dst++ = *src++) == '\0')
break;
}
}
/* Not enough room in dst, add NUL and traverse rest of src. */
if (nleft == 0) {
if (dsize != 0)
*dst = '\0'; /* NUL-terminate dst */
while (*src++)
;
}
return(src - osrc - 1); /* count does not include NUL */
const char *osrc = src;
size_t nleft = dsize;
/* Copy as many bytes as will fit. */
if (nleft != 0) {
while (--nleft != 0) {
if ((*dst++ = *src++) == '\0')
break;
}
}
/* Not enough room in dst, add NUL and traverse rest of src. */
if (nleft == 0) {
if (dsize != 0)
*dst = '\0'; /* NUL-terminate dst */
while (*src++)
;
}
return(src - osrc - 1); /* count does not include NUL */
}
size_t
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment