Changeset - r27690:05020f9cd786
[Not reviewed]
master
0 3 0
Rubidium - 10 months ago 2023-06-27 15:07:56
rubidium@openttd.org
Remove: now unused stredup
3 files changed with 1 insertions and 17 deletions:
0 comments (0 inline, 0 general)
src/safeguards.h
Show inline comments
 
@@ -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
 

	
src/string.cpp
Show inline comments
 
@@ -81,21 +81,6 @@ char *strecpy(char *dst, const char *src
 
}
 

	
 
/**
 
 * 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
 
 * @return Converted string.
src/string_func.h
Show inline comments
 
@@ -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);
 

	
0 comments (0 inline, 0 general)