Commit 24da710f authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 8f706761
......@@ -111,7 +111,7 @@ error _Conn::close() {
// XXX errctx "close conn @%s", wconn.at
// XXX + conn # e.g. from wconn._wlink.id? or wlink.close should include its id itself?
error err, eret;
auto reterr1 = [&eret](const error& err) {
auto reterr1 = [&eret](error err) {
if (eret == nil && err != nil)
eret = err;
};
......@@ -144,6 +144,11 @@ error _Conn::close() {
}
wconn._filehtab.clear();
// XXX -> try to top
if (eret != nil)
eret = fmt::errorf("close conn @%s: %s", h_(wconn.at), v(eret));
return eret;
}
......
......@@ -156,6 +156,37 @@ namespace wcfs {
// TidHead is invalid Tid which is largest Tid value and means @head.
const zodb::Tid TidHead = -1ULL;
// v mimics %v for T to be used in printf & friends.
//
// NOTE returned char* pointer is guaranteed to stay valid till end of current expression.
// e.g.
//
// printf("hello %s", v(obj))
//
// is valid, while
//
// x = v(obj);
// use(x);
//
// is not valid.
#define v(obj) (v_(obj).c_str())
template<typename T> string v_(T obj) {
return obj.String();
}
template<> inline string v_(error err) {
return (err != nil) ? err->Error() : "nil";
}
#if 0
const char *v(error err) {
if (err != nil)
return err->Error().c_str(); // XXX Error() gives temp. obj
return "nil";
}
#endif
} // wcfs::
#endif
......@@ -30,14 +30,6 @@
namespace wcfs {
// v mimics %v for error
// XXX temp, place, ok=?
const char *v(error err) {
if (err != nil)
return err->Error().c_str(); // XXX Error() gives temp. obj
return "nil";
}
_WatchLink::_WatchLink() {}
_WatchLink::~_WatchLink() {}
void _WatchLink::decref() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment