Fix a few minor issues detected by CppCheck
Thanks to Dmitry Andriyankov for reporting.
diff --git a/format.cc b/format.cc
index 82019f8..76988b4 100644
--- a/format.cc
+++ b/format.cc
@@ -474,9 +474,8 @@
FMT_TRY {
MemoryBuffer<char, INLINE_BUFFER_SIZE> buffer;
buffer.resize(INLINE_BUFFER_SIZE);
- char *system_message = 0;
for (;;) {
- system_message = &buffer[0];
+ char *system_message = &buffer[0];
int result = safe_strerror(error_code, system_message, buffer.size());
if (result == 0) {
out << message << ": " << system_message;
@@ -888,7 +887,6 @@
const Char *fmt::BasicFormatter<Char>::format(
const Char *&format_str, const Arg &arg) {
const Char *s = format_str;
- const char *error = 0;
FormatSpec spec;
if (*s == ':') {
if (arg.type == Arg::CUSTOM) {
@@ -962,8 +960,6 @@
// Zero may be parsed again as a part of the width, but it is simpler
// and more efficient than checking if the next char is a digit.
spec.width_ = parse_nonnegative_int(s);
- if (error)
- FMT_THROW(FormatError(error));
}
// Parse precision.
@@ -972,8 +968,6 @@
spec.precision_ = 0;
if ('0' <= *s && *s <= '9') {
spec.precision_ = parse_nonnegative_int(s);
- if (error)
- FMT_THROW(FormatError(error));
} else if (*s == '{') {
++s;
const Arg &precision_arg = parse_arg_index(s);