MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / appendfv

Method appendfv

KBotExt/imgui/imgui.cpp:2634–2658  ·  view source on GitHub ↗

Helper: Text buffer for logging/accumulating text

Source from the content-addressed store, hash-verified

2632
2633// Helper: Text buffer for logging/accumulating text
2634void ImGuiTextBuffer::appendfv(const char* fmt, va_list args)
2635{
2636 va_list args_copy;
2637 va_copy(args_copy, args);
2638
2639 int len = ImFormatStringV(NULL, 0, fmt, args); // FIXME-OPT: could do a first pass write attempt, likely successful on first pass.
2640 if (len <= 0)
2641 {
2642 va_end(args_copy);
2643 return;
2644 }
2645
2646 // Add zero-terminator the first time
2647 const int write_off = (Buf.Size != 0) ? Buf.Size : 1;
2648 const int needed_sz = write_off + len;
2649 if (write_off + len >= Buf.Capacity)
2650 {
2651 int new_capacity = Buf.Capacity * 2;
2652 Buf.reserve(needed_sz > new_capacity ? needed_sz : new_capacity);
2653 }
2654
2655 Buf.resize(needed_sz);
2656 ImFormatStringV(&Buf[write_off - 1], (size_t)len + 1, fmt, args_copy);
2657 va_end(args_copy);
2658}
2659
2660void ImGuiTextIndex::append(const char* base, int old_size, int new_size)
2661{

Callers 2

LogTextVFunction · 0.80
DebugLogVMethod · 0.80

Calls 2

ImFormatStringVFunction · 0.85
reserveMethod · 0.80

Tested by

no test coverage detected