empiredan commented on code in PR #1818:
URL:
https://github.com/apache/incubator-pegasus/pull/1818#discussion_r1439209468
##########
src/utils/fmt_logging.h:
##########
@@ -275,16 +275,26 @@ inline const char *null_str_printer(const char *s) {
return s == nullptr ? "(nul
LOG_AND_RETURN_NOT_TRUE(level, _err == ::dsn::ERR_OK, _err,
__VA_ARGS__); \
} while (0)
-// Return the given rocksdb::Status 's' if it is not OK.
-#define LOG_AND_RETURN_NOT_RDB_OK(level, s, ...)
\
+// Return the given rocksdb::Status of 'exp' if it is not OK.
+#define LOG_AND_RETURN_NOT_RDB_OK(level, exp, ...)
\
do {
\
- const auto &_s = (s);
\
+ const auto &_s = (exp);
\
if (dsn_unlikely(!_s.ok())) {
\
LOG_##level("{}: {}", _s.ToString(), fmt::format(__VA_ARGS__));
\
return _s;
\
}
\
} while (0)
+// Return the given 'err' code if 'exp' is not OK.
+#define LOG_AND_RETURN_CODE_NOT_RDB_OK(level, exp, err, ...)
\
+ do {
\
+ const auto _s = (exp);
\
+ if (dsn_unlikely(!_s.ok())) {
\
+ LOG_##level("{}: {}", _s.ToString(), fmt::format(__VA_ARGS__));
\
Review Comment:
```suggestion
const auto &s = (exp);
\
if (dsn_unlikely(!s.ok())) {
\
LOG_##level("{}: {}", s.ToString(), fmt::format(__VA_ARGS__));
\
```
##########
src/utils/fmt_logging.h:
##########
@@ -275,16 +275,26 @@ inline const char *null_str_printer(const char *s) {
return s == nullptr ? "(nul
LOG_AND_RETURN_NOT_TRUE(level, _err == ::dsn::ERR_OK, _err,
__VA_ARGS__); \
} while (0)
-// Return the given rocksdb::Status 's' if it is not OK.
-#define LOG_AND_RETURN_NOT_RDB_OK(level, s, ...)
\
+// Return the given rocksdb::Status of 'exp' if it is not OK.
+#define LOG_AND_RETURN_NOT_RDB_OK(level, exp, ...)
\
do {
\
- const auto &_s = (s);
\
+ const auto &_s = (exp);
\
if (dsn_unlikely(!_s.ok())) {
\
LOG_##level("{}: {}", _s.ToString(), fmt::format(__VA_ARGS__));
\
return _s;
\
Review Comment:
```suggestion
const auto &s = (exp);
\
if (dsn_unlikely(!s.ok())) {
\
LOG_##level("{}: {}", s.ToString(), fmt::format(__VA_ARGS__));
\
return s;
\
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]