1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-21 21:49:10 +00:00

Codechange: use std::string to return the debug level information

This commit is contained in:
Rubidium
2023-06-02 16:08:45 +02:00
committed by rubidium42
parent 10e12154f5
commit 53f83c31b0
2 changed files with 7 additions and 15 deletions

View File

@@ -220,22 +220,14 @@ void SetDebugString(const char *s, void (*error_func)(const std::string &))
* Just return a string with the values of all the debug categories.
* @return string with debug-levels
*/
const char *GetDebugString()
std::string GetDebugString()
{
const DebugLevel *i;
static char dbgstr[150];
char dbgval[20];
memset(dbgstr, 0, sizeof(dbgstr));
i = debug_level;
seprintf(dbgstr, lastof(dbgstr), "%s=%d", i->name, *i->level);
for (i++; i != endof(debug_level); i++) {
seprintf(dbgval, lastof(dbgval), ", %s=%d", i->name, *i->level);
strecat(dbgstr, dbgval, lastof(dbgstr));
std::string result;
for (const DebugLevel *i = debug_level; i != endof(debug_level); ++i) {
if (!result.empty()) result += ", ";
fmt::format_to(std::back_inserter(result), "{}={}", i->name, *i->level);
}
return dbgstr;
return result;
}
/**