Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 18ac9479 authored by Yifan Hong's avatar Yifan Hong
Browse files

binder: move TEST_AND_RETURN to Utils.

... so it can be used elsewhere.

Test: pass
Bug: 198833574
Change-Id: I1429c66f13c50d61f26f8fe99c846a622c83cc28
parent cf2e66bf
Loading
Loading
Loading
Loading
+1 −8
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@

#include "FdTrigger.h"
#include "RpcState.h"
#include "Utils.h"

#define SHOULD_LOG_TLS_DETAIL false

@@ -35,14 +36,6 @@
#define LOG_TLS_DETAIL(...) ALOGV(__VA_ARGS__) // for type checking
#endif

#define TEST_AND_RETURN(value, expr)            \
    do {                                        \
        if (!(expr)) {                          \
            ALOGE("Failed to call: %s", #expr); \
            return value;                       \
        }                                       \
    } while (0)

using android::base::ErrnoError;
using android::base::Error;
using android::base::Result;
+9 −0
Original line number Diff line number Diff line
@@ -19,6 +19,15 @@

#include <android-base/result.h>
#include <android-base/unique_fd.h>
#include <log/log.h>

#define TEST_AND_RETURN(value, expr)            \
    do {                                        \
        if (!(expr)) {                          \
            ALOGE("Failed to call: %s", #expr); \
            return value;                       \
        }                                       \
    } while (0)

namespace android {