From: Ondrej Kozina Date: Thu, 31 Jan 2013 15:01:40 +0000 (+0100) Subject: - add index and simplify operator<<(xa_value_t) X-Git-Tag: v0.1.3~18^2~39 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=788be1d0fb2bb7f5b003aa80f37290668801d775;p=thirdparty%2Fsnapper.git - add index and simplify operator<<(xa_value_t) --- diff --git a/snapper/XAttributes.cc b/snapper/XAttributes.cc index 6dfbd99e..ea31b74d 100644 --- a/snapper/XAttributes.cc +++ b/snapper/XAttributes.cc @@ -136,17 +136,16 @@ namespace snapper operator<<(ostream &out, const xa_value_t &xavalue) { char tmp[4]; + int pos = 0; xa_value_t::const_iterator cit = xavalue.begin(); while (cit != xavalue.end()) { sprintf(tmp, "%d", *cit); - out << tmp; - if (++cit == xavalue.end()) - out << ""; - else - out << ":"; + out << '<' << pos++ << '>' << tmp; + if (++cit != xavalue.end()) + out << ':'; } return out;