The plain formatter flush needs to append eol if needed, and
not to clear the sections stack.
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
if (!buf)
return;
- os << buf;
- os.flush();
- reset();
+ if (len) {
+ os << buf << "\n";
+ os.flush();
+ }
+
+ reset_buf();
}
-void RGWFormatter_Plain::reset()
+void RGWFormatter_Plain::reset_buf()
{
free(buf);
buf = NULL;
len = 0;
max_len = 0;
+}
+void RGWFormatter_Plain::reset()
+{
+ reset_buf();
stack.clear();
min_stack_level = 0;
}
* There is a much better way to do this.
*/
class RGWFormatter_Plain : public Formatter {
+ void reset_buf();
public:
RGWFormatter_Plain();
virtual ~RGWFormatter_Plain();