MCPcopy Create free account
hub / github.com/Overload-Technologies/Overload / appendfv

Method appendfv

Dependencies/ImGui/src/imgui.cpp:3010–3034  ·  view source on GitHub ↗

Helper: Text buffer for logging/accumulating text

Source from the content-addressed store, hash-verified

3008
3009// Helper: Text buffer for logging/accumulating text
3010void ImGuiTextBuffer::appendfv(const char* fmt, va_list args)
3011{
3012 va_list args_copy;
3013 va_copy(args_copy, args);
3014
3015 int len = ImFormatStringV(NULL, 0, fmt, args); // FIXME-OPT: could do a first pass write attempt, likely successful on first pass.
3016 if (len <= 0)
3017 {
3018 va_end(args_copy);
3019 return;
3020 }
3021
3022 // Add zero-terminator the first time
3023 const int write_off = (Buf.Size != 0) ? Buf.Size : 1;
3024 const int needed_sz = write_off + len;
3025 if (write_off + len >= Buf.Capacity)
3026 {
3027 int new_capacity = Buf.Capacity * 2;
3028 Buf.reserve(needed_sz > new_capacity ? needed_sz : new_capacity);
3029 }
3030
3031 Buf.resize(needed_sz);
3032 ImFormatStringV(&Buf[write_off - 1], (size_t)len + 1, fmt, args_copy);
3033 va_end(args_copy);
3034}
3035
3036void ImGuiTextIndex::append(const char* base, int old_size, int new_size)
3037{

Callers 2

LogTextVFunction · 0.80
DebugLogVMethod · 0.80

Calls 3

ImFormatStringVFunction · 0.85
reserveMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected