Skip to content

Commit

Permalink
rocket/format: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lhmouse committed Aug 30, 2021
1 parent 616629b commit bdfbd7e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions asteria/rocket/format.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,25 +81,23 @@ vformat(basic_tinyfmt<charT, traitsT>& fmt, const charT* stempl, size_t ntempl,
"format: incomplete placeholder (dangling `$`)");

typename traitsT::int_type ch = traitsT::to_int_type(*++pp);
size_t index = 0;
bp = ++pp;

// Replace the placeholder.
if(ch == '$') {
// Write a plain dollar sign.
fmt.putc(traitsT::to_char_type('$'));
continue;
}

// The placeholder shall contain a valid index.
size_t index = 0;
switch(ch) {
case '{': {
// Look for the terminator.
bp = traitsT::find(bp, static_cast<size_t>(ep - bp),
traitsT::to_char_type('}'));
if(!bp)
noadl::sprintf_and_throw<invalid_argument>(
"format: incomplete placeholder (no matching `}`)");
"format: incomplete placeholder (missing `}`)");

// Parse the argument index.
ptrdiff_t ndigs = bp++ - pp;
Expand Down

0 comments on commit bdfbd7e

Please sign in to comment.