lib/pcre/UniqueRegex: use libfmt

This commit is contained in:
Max Kellermann 2023-03-06 19:59:01 +01:00
parent 00d5e6e9c7
commit c8f54b3509
2 changed files with 4 additions and 5 deletions

View File

@ -4,8 +4,7 @@
#include "UniqueRegex.hxx"
#include "Error.hxx"
#include <stdio.h>
#include "lib/fmt/ToBuffer.hxx"
void
UniqueRegex::Compile(const char *pattern, bool anchored, bool capture,
@ -28,9 +27,8 @@ UniqueRegex::Compile(const char *pattern, bool anchored, bool capture,
&error_number, &error_offset,
nullptr);
if (re == nullptr) {
char msg[256];
snprintf(msg, sizeof(msg), "Error in regex at offset %zu",
error_offset);
const auto msg = FmtBuffer<256>("Error in regex at offset {}",
error_offset);
throw Pcre::MakeError(error_number, msg);
}

View File

@ -16,6 +16,7 @@ pcre = static_library(
include_directories: inc,
dependencies: [
pcre_dep,
fmt_dep,
],
)