Remove: now unused stredup

This commit is contained in:
Rubidium 2023-06-27 17:07:56 +02:00 committed by rubidium42
parent 2ec4ea2b99
commit e04d43f396
3 changed files with 1 additions and 17 deletions

View File

@ -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

View File

@ -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

View File

@ -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);