Remove String::Combine kernel function.

This function has followed me through a few projects for many years. It's
time to retire it. It's not too terribly well-written and it's mostly
replaced by the standard asprintf call. It's not even used in Sortix at the
moment.
This commit is contained in:
Jonas 'Sortie' Termansen 2014-08-03 00:07:14 +02:00
parent 3d091f39bf
commit 76bf0eb30c
2 changed files with 0 additions and 44 deletions

View File

@ -31,7 +31,6 @@ namespace Sortix {
namespace String {
char* Clone(const char* Source);
char* Combine(size_t NumParameters, ...);
char* Substring(const char* src, size_t offset, size_t length);
bool StartsWith(const char* Haystack, const char* Needle);

View File

@ -52,48 +52,5 @@ char* Substring(const char* src, size_t offset, size_t length)
return dest;
}
char* Combine(size_t NumParameters, ...)
{
va_list param_pt;
va_start(param_pt, NumParameters);
// First calculate the string length.
size_t ResultLength = 0;
const char* TMP = 0;
for ( size_t I = 0; I < NumParameters; I++ )
{
TMP = va_arg(param_pt, const char*);
if ( TMP != NULL ) { ResultLength += strlen(TMP); }
}
// Allocate a string with the desired length.
char* Result = new char[ResultLength+1];
if ( !Result ) { return NULL; }
Result[0] = 0;
va_end(param_pt);
va_start(param_pt, NumParameters);
size_t ResultOffset = 0;
for ( size_t I = 0; I < NumParameters; I++ )
{
TMP = va_arg(param_pt, const char*);
if ( TMP )
{
size_t TMPLength = strlen(TMP);
strcpy(Result + ResultOffset, TMP);
ResultOffset += TMPLength;
}
}
return Result;
}
} // namespace String
} // namespace Sortix