mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +00:00
Add a simple StringBuilder::appendf() and use it for ProcFS.
Okay, now ProcFS doesn't crash due to the crappy buffer size estimates not really working out. This thing has dogshit performance and I will fix that separately.
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
#include "StringBuilder.h"
|
||||
#include <LibC/stdarg.h>
|
||||
#include "printf.cpp"
|
||||
|
||||
namespace AK {
|
||||
|
||||
@@ -17,6 +19,16 @@ void StringBuilder::append(char ch)
|
||||
m_strings.append(StringImpl::create(&ch, 1));
|
||||
}
|
||||
|
||||
void StringBuilder::appendf(const char* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
printfInternal([this] (char*&, char ch) {
|
||||
append(ch);
|
||||
}, nullptr, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
String StringBuilder::build()
|
||||
{
|
||||
auto strings = move(m_strings);
|
||||
|
||||
Reference in New Issue
Block a user