mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Move templated str_copy
next to basic function
The functions were only separated because we previously had a large `extern "C"` block.
This commit is contained in:
parent
9a57def5a6
commit
410ccda1c7
|
@ -1227,6 +1227,23 @@ void str_append(char (&dst)[N], const char *src)
|
||||||
*/
|
*/
|
||||||
int str_copy(char *dst, const char *src, int dst_size);
|
int str_copy(char *dst, const char *src, int dst_size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copies a string to a fixed-size array of chars.
|
||||||
|
*
|
||||||
|
* @ingroup Strings
|
||||||
|
*
|
||||||
|
* @param dst Array that shall receive the string.
|
||||||
|
* @param src String to be copied.
|
||||||
|
*
|
||||||
|
* @remark The strings are treated as zero-terminated strings.
|
||||||
|
* @remark Guarantees that dst string will contain zero-termination.
|
||||||
|
*/
|
||||||
|
template<int N>
|
||||||
|
void str_copy(char (&dst)[N], const char *src)
|
||||||
|
{
|
||||||
|
str_copy(dst, src, N);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Truncates a utf8 encoded string to a given length.
|
* Truncates a utf8 encoded string to a given length.
|
||||||
*
|
*
|
||||||
|
@ -2797,23 +2814,6 @@ bool shell_unregister_application(const char *executable, bool *updated);
|
||||||
void shell_update();
|
void shell_update();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* Copies a string to a fixed-size array of chars.
|
|
||||||
*
|
|
||||||
* @ingroup Strings
|
|
||||||
*
|
|
||||||
* @param dst Array that shall receive the string.
|
|
||||||
* @param src String to be copied.
|
|
||||||
*
|
|
||||||
* @remark The strings are treated as zero-terminated strings.
|
|
||||||
* @remark Guarantees that dst string will contain zero-termination.
|
|
||||||
*/
|
|
||||||
template<int N>
|
|
||||||
void str_copy(char (&dst)[N], const char *src)
|
|
||||||
{
|
|
||||||
str_copy(dst, src, N);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct std::hash<NETADDR>
|
struct std::hash<NETADDR>
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue