(svn r26485) -Codechange: Replace ttd_strlcpy and ttd_strlcat with strecpy and strecat.
This commit is contained in:
@@ -51,56 +51,6 @@ static int CDECL vseprintf(char *str, const char *last, const char *format, va_l
|
||||
return min((int)diff, vsnprintf(str, diff + 1, format, ap));
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends characters from one string to another.
|
||||
*
|
||||
* Appends the source string to the destination string with respect of the
|
||||
* terminating null-character and the maximum size of the destination
|
||||
* buffer.
|
||||
*
|
||||
* @note usage ttd_strlcat(dst, src, lengthof(dst));
|
||||
* @note lengthof() applies only to fixed size arrays
|
||||
*
|
||||
* @param dst The buffer containing the target string
|
||||
* @param src The buffer containing the string to append
|
||||
* @param size The maximum size of the destination buffer
|
||||
*/
|
||||
void ttd_strlcat(char *dst, const char *src, size_t size)
|
||||
{
|
||||
assert(size > 0);
|
||||
while (size > 0 && *dst != '\0') {
|
||||
size--;
|
||||
dst++;
|
||||
}
|
||||
|
||||
ttd_strlcpy(dst, src, size);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Copies characters from one buffer to another.
|
||||
*
|
||||
* Copies the source string to the destination buffer with respect of the
|
||||
* terminating null-character and the maximum size of the destination
|
||||
* buffer.
|
||||
*
|
||||
* @note usage ttd_strlcpy(dst, src, lengthof(dst));
|
||||
* @note lengthof() applies only to fixed size arrays
|
||||
*
|
||||
* @param dst The destination buffer
|
||||
* @param src The buffer containing the string to copy
|
||||
* @param size The maximum size of the destination buffer
|
||||
*/
|
||||
void ttd_strlcpy(char *dst, const char *src, size_t size)
|
||||
{
|
||||
assert(size > 0);
|
||||
while (--size > 0 && *src != '\0') {
|
||||
*dst++ = *src++;
|
||||
}
|
||||
*dst = '\0';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Appends characters from one string to another.
|
||||
*
|
||||
|
Reference in New Issue
Block a user