Get rid of the BasicFormatter::start_

This commit is contained in:
vitaut 2015-07-28 06:46:41 -07:00
parent 69a0317590
commit 0eac037416
2 changed files with 7 additions and 8 deletions

View File

@ -1192,7 +1192,6 @@ const Char *fmt::BasicFormatter<Char>::format(
if (*s++ != '}') if (*s++ != '}')
FMT_THROW(FormatError("missing '}' in format string")); FMT_THROW(FormatError("missing '}' in format string"));
start_ = s;
// Format argument. // Format argument.
internal::ArgFormatter<Char>(*this, spec, s - 1).visit(arg); internal::ArgFormatter<Char>(*this, spec, s - 1).visit(arg);
@ -1202,23 +1201,24 @@ const Char *fmt::BasicFormatter<Char>::format(
template <typename Char> template <typename Char>
void fmt::BasicFormatter<Char>::format( void fmt::BasicFormatter<Char>::format(
BasicCStringRef<Char> format_str, const ArgList &args) { BasicCStringRef<Char> format_str, const ArgList &args) {
const Char *s = start_ = format_str.c_str(); const Char *s = format_str.c_str();
const Char *start = s;
set_args(args); set_args(args);
while (*s) { while (*s) {
Char c = *s++; Char c = *s++;
if (c != '{' && c != '}') continue; if (c != '{' && c != '}') continue;
if (*s == c) { if (*s == c) {
write(writer_, start_, s); write(writer_, start, s);
start_ = ++s; start = ++s;
continue; continue;
} }
if (c == '}') if (c == '}')
FMT_THROW(FormatError("unmatched '}' in format string")); FMT_THROW(FormatError("unmatched '}' in format string"));
write(writer_, start_, s - 1); write(writer_, start, s - 1);
Arg arg = is_name_start(*s) ? parse_arg_name(s) : parse_arg_index(s); Arg arg = is_name_start(*s) ? parse_arg_name(s) : parse_arg_index(s);
s = format(s, arg); start = s = format(s, arg);
} }
write(writer_, start_, s); write(writer_, start, s);
} }
FMT_FUNC void fmt::report_system_error( FMT_FUNC void fmt::report_system_error(

View File

@ -1326,7 +1326,6 @@ template <typename Char>
class BasicFormatter : private internal::FormatterBase { class BasicFormatter : private internal::FormatterBase {
private: private:
BasicWriter<Char> &writer_; BasicWriter<Char> &writer_;
const Char *start_;
internal::ArgMap<Char> map_; internal::ArgMap<Char> map_;
FMT_DISALLOW_COPY_AND_ASSIGN(BasicFormatter); FMT_DISALLOW_COPY_AND_ASSIGN(BasicFormatter);