mirror of
https://github.com/mawww/kakoune.git
synced 2024-11-29 10:02:57 +03:00
Replace snprintf with format_to
This commit is contained in:
parent
465e0280d8
commit
0880399fbe
@ -1,6 +1,7 @@
|
||||
#include "backtrace.hh"
|
||||
|
||||
#include "string.hh"
|
||||
#include "string_utils.hh"
|
||||
|
||||
#if defined(__GLIBC__) || defined(__APPLE__)
|
||||
# include <execinfo.h>
|
||||
@ -62,7 +63,7 @@ String Backtrace::desc() const
|
||||
{
|
||||
SymFromAddr(process, (DWORD64)stackframes[i], 0, symbol_info);
|
||||
char desc[276];
|
||||
snprintf(desc, 276, "0x%0llx (%s)\n", symbol_info->Address, symbol_info->Name);
|
||||
format_to(desc, "0x{} ({})\n", hex(symbol_info->Address), symbol_info->Name);
|
||||
res += desc;
|
||||
}
|
||||
return res;
|
||||
|
@ -1117,7 +1117,7 @@ private:
|
||||
int digit_count = compute_digit_count(context.context);
|
||||
|
||||
char format[16];
|
||||
format_to(format, "%{}d", digit_count);
|
||||
format_to(format, "\\{:{}}", digit_count);
|
||||
const int main_line = (int)context.context.selections().main().cursor().line + 1;
|
||||
int last_line = -1;
|
||||
for (auto& line : display_buffer.lines())
|
||||
@ -1127,7 +1127,7 @@ private:
|
||||
const int line_to_format = (m_relative and not is_cursor_line) ?
|
||||
current_line - main_line : current_line;
|
||||
char buffer[16];
|
||||
snprintf(buffer, 16, format, std::abs(line_to_format));
|
||||
format_to(buffer, format, std::abs(line_to_format));
|
||||
const auto atom_face = last_line == current_line ? face_wrapped :
|
||||
((m_hl_cursor_line and is_cursor_line) ? face_absolute : face);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user