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

Commit 2133bd54 authored by Steven Moreland's avatar Steven Moreland Committed by Automerger Merge Worker
Browse files

Merge "libbinder_ndk: avoid need to allocate heap status" am: 9b1e10db

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1434715

Change-Id: I19990cb0a61321960ec2dd248b0ce4fb8b3ce135
parents cb85ca85 9b1e10db
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -199,6 +199,9 @@ class ScopedAStatus : public impl::ScopedAResource<AStatus*, void, AStatus_delet
   public:
    /**
     * Takes ownership of a.
     *
     * WARNING: this constructor is only expected to be used when reading a
     *     status value. Use `ScopedAStatus::ok()` instead.
     */
    explicit ScopedAStatus(AStatus* a = nullptr) : ScopedAResource(a) {}
    ~ScopedAStatus() {}
+5 −2
Original line number Diff line number Diff line
@@ -23,7 +23,8 @@ using ::android::status_t;
using ::android::binder::Status;

AStatus* AStatus_newOk() {
    return new AStatus();
    static AStatus status = AStatus();
    return &status;
}

AStatus* AStatus_fromExceptionCode(binder_exception_t exception) {
@@ -78,8 +79,10 @@ void AStatus_deleteDescription(const char* description) {
}

void AStatus_delete(AStatus* status) {
    if (status != AStatus_newOk()) {
        delete status;
    }
}

binder_status_t PruneStatusT(status_t status) {
    switch (status) {