You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pegasus.apache.org by "Samunroyu (via GitHub)" <gi...@apache.org> on 2024/01/11 12:01:45 UTC

[PR] feat(marco): Add ERRS_NOT_TRUE marco to simplify code [incubator-pegasus]

Samunroyu opened a new pull request, #1849:
URL: https://github.com/apache/incubator-pegasus/pull/1849

   ### What problem does this PR solve? <!--add issue link with summary if exists-->
   Add RETURN_ERRS_NOT_TRUE marco to simplify code
   
   ### What is changed and how does it work?
   
   ##### Code changes
   
   ##### Side effects
   
   ##### Related changes
   
   


-- 
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: dev-unsubscribe@pegasus.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org


Re: [PR] feat(marco): Add RETURN_ERRS_NOT_TRUE marco to simplify code [incubator-pegasus]

Posted by "empiredan (via GitHub)" <gi...@apache.org>.
empiredan merged PR #1849:
URL: https://github.com/apache/incubator-pegasus/pull/1849


-- 
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: dev-unsubscribe@pegasus.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org


Re: [PR] feat(marco): Add RETURN_ERRS_NOT_TRUE marco to simplify code [incubator-pegasus]

Posted by "empiredan (via GitHub)" <gi...@apache.org>.
empiredan commented on code in PR #1849:
URL: https://github.com/apache/incubator-pegasus/pull/1849#discussion_r1448766697


##########
src/utils/errors.h:
##########
@@ -238,3 +238,10 @@ USER_DEFINED_STRUCTURE_FORMATTER(::dsn::error_s);
         const ::dsn::error_s &_s = (s);                                                            \
         CHECK(_s.is_ok(), fmt::format(__VA_ARGS__));                                               \
     } while (false);
+
+#define RETURN_ERRS_NOT_TRUE(exp, code, ...)                                                       \
+    do {                                                                                           \
+        if (dsn_unlikely(!exp)) {                                                                  \

Review Comment:
   ```suggestion
           if (dsn_unlikely(!(exp))) {                                                                  \
   ```



##########
src/utils/errors.h:
##########
@@ -238,3 +238,10 @@ USER_DEFINED_STRUCTURE_FORMATTER(::dsn::error_s);
         const ::dsn::error_s &_s = (s);                                                            \
         CHECK(_s.is_ok(), fmt::format(__VA_ARGS__));                                               \
     } while (false);
+
+#define RETURN_ERRS_NOT_TRUE(exp, code, ...)                                                       \
+    do {                                                                                           \
+        if (dsn_unlikely(!exp)) {                                                                  \
+            return dsn::error_s::make(code, fmt::format(__VA_ARGS__));                             \
+        }                                                                                          \
+    } while (false);

Review Comment:
   ```suggestion
       } while (false)
   ```



-- 
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: dev-unsubscribe@pegasus.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org


Re: [PR] feat(marco): Add RETURN_ERRS_NOT_TRUE marco to simplify code [incubator-pegasus]

Posted by "acelyc111 (via GitHub)" <gi...@apache.org>.
acelyc111 commented on code in PR #1849:
URL: https://github.com/apache/incubator-pegasus/pull/1849#discussion_r1449010874


##########
src/utils/errors.h:
##########
@@ -238,3 +238,10 @@ USER_DEFINED_STRUCTURE_FORMATTER(::dsn::error_s);
         const ::dsn::error_s &_s = (s);                                                            \
         CHECK(_s.is_ok(), fmt::format(__VA_ARGS__));                                               \
     } while (false);
+
+#define RETURN_ERRS_NOT_TRUE(exp, code, ...)                                                       \
+    do {                                                                                           \
+        if (dsn_unlikely(!(exp))) {                                                                  \
+            return dsn::error_s::make(code, fmt::format(__VA_ARGS__));                             \

Review Comment:
   ```suggestion
           if (dsn_unlikely(!(exp))) {                                                                \
               return dsn::error_s::make(code, fmt::format(__VA_ARGS__));                             \
   ```



-- 
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: dev-unsubscribe@pegasus.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org