mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 22:28:56 +00:00
Remove: now unused stredup
This commit is contained in:
parent
2ec4ea2b99
commit
e04d43f396
@ -28,7 +28,7 @@
|
||||
/* Use ReallocT instead. */
|
||||
#define realloc SAFEGUARD_DO_NOT_USE_THIS_METHOD
|
||||
|
||||
/* Use stredup instead. */
|
||||
/* Use std::string instead. */
|
||||
#define strdup SAFEGUARD_DO_NOT_USE_THIS_METHOD
|
||||
#define strndup SAFEGUARD_DO_NOT_USE_THIS_METHOD
|
||||
|
||||
|
@ -80,21 +80,6 @@ char *strecpy(char *dst, const char *src, const char *last)
|
||||
return dst;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a duplicate of the given string.
|
||||
* @param s The string to duplicate.
|
||||
* @param last The last character that is safe to duplicate. If nullptr, the whole string is duplicated.
|
||||
* @note The maximum length of the resulting string might therefore be last - s + 1.
|
||||
* @return The duplicate of the string.
|
||||
*/
|
||||
char *stredup(const char *s, const char *last)
|
||||
{
|
||||
size_t len = last == nullptr ? strlen(s) : ttd_strnlen(s, last - s + 1);
|
||||
char *tmp = CallocT<char>(len + 1);
|
||||
memcpy(tmp, s, len);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a byte array into a continuous hex string.
|
||||
* @param data Array to format
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "string_type.h"
|
||||
|
||||
char *strecpy(char *dst, const char *src, const char *last) NOACCESS(3);
|
||||
char *stredup(const char *src, const char *last = nullptr) NOACCESS(2);
|
||||
|
||||
std::string FormatArrayAsHex(span<const byte> data);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user