mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-06 23:30:29 +00:00
use memchr for searching for '%' in printf format string (#1984)
This commit is contained in:
parent
4c2d637203
commit
3302fd1088
@ -474,8 +474,11 @@ OutputIt basic_printf_context<OutputIt, Char>::format() {
|
|||||||
const Char* end = parse_ctx_.end();
|
const Char* end = parse_ctx_.end();
|
||||||
auto it = start;
|
auto it = start;
|
||||||
while (it != end) {
|
while (it != end) {
|
||||||
|
if (!detail::find<false, Char>(it, end, '%', it)) {
|
||||||
|
it = end; // detail::find leaves it == nullptr if it doesn't find '%'
|
||||||
|
break;
|
||||||
|
}
|
||||||
char_type c = *it++;
|
char_type c = *it++;
|
||||||
if (c != '%') continue;
|
|
||||||
if (it != end && *it == c) {
|
if (it != end && *it == c) {
|
||||||
out = std::copy(start, it, out);
|
out = std::copy(start, it, out);
|
||||||
start = ++it;
|
start = ++it;
|
||||||
|
Loading…
Reference in New Issue
Block a user