From e04d43f396edc3d9e8353268a96327df9ed9dc23 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Tue, 27 Jun 2023 17:07:56 +0200 Subject: [PATCH] Remove: now unused stredup --- src/safeguards.h | 2 +- src/string.cpp | 15 --------------- src/string_func.h | 1 - 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/src/safeguards.h b/src/safeguards.h index 09cfe9a919..daf941482a 100644 --- a/src/safeguards.h +++ b/src/safeguards.h @@ -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 diff --git a/src/string.cpp b/src/string.cpp index 4795a226e7..5acc14147d 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -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(len + 1); - memcpy(tmp, s, len); - return tmp; -} - /** * Format a byte array into a continuous hex string. * @param data Array to format diff --git a/src/string_func.h b/src/string_func.h index 62f472d26f..2286f2fe25 100644 --- a/src/string_func.h +++ b/src/string_func.h @@ -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 data);