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

Commit 9b1e10db authored by Steven Moreland's avatar Steven Moreland Committed by Gerrit Code Review
Browse files

Merge "libbinder_ndk: avoid need to allocate heap status"

parents 094560d1 4a1026a7
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) {