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

Commit 4d70c4ed authored by Steven Moreland's avatar Steven Moreland Committed by android-build-merger
Browse files

Merge "libbinder_ndk: _delete APIs take * not **." am: 85eaa63b am: ec5d97b9

am: 502f7b14

Change-Id: I949be1fd672c26e57be3f735ad168ab68e7a40a8
parents ab19909a 502f7b14
Loading
Loading
Loading
Loading
+10 −15
Original line number Diff line number Diff line
@@ -198,13 +198,8 @@ AIBinder_Weak* AIBinder_Weak_new(AIBinder* binder) {

    return new AIBinder_Weak{wp<AIBinder>(binder)};
}
void AIBinder_Weak_delete(AIBinder_Weak** weakBinder) {
    if (weakBinder == nullptr) {
        return;
    }

    delete *weakBinder;
    *weakBinder = nullptr;
void AIBinder_Weak_delete(AIBinder_Weak* weakBinder) {
    delete weakBinder;
}
AIBinder* AIBinder_Weak_promote(AIBinder_Weak* weakBinder) {
    if (weakBinder == nullptr) {
@@ -437,6 +432,11 @@ binder_status_t AIBinder_prepareTransaction(AIBinder* binder, AParcel** in) {
    return ret;
}

static void DestroyParcel(AParcel** parcel) {
    delete *parcel;
    *parcel = nullptr;
}

binder_status_t AIBinder_transact(AIBinder* binder, transaction_code_t code, AParcel** in,
                                  AParcel** out, binder_flags_t flags) {
    if (in == nullptr) {
@@ -447,7 +447,7 @@ binder_status_t AIBinder_transact(AIBinder* binder, transaction_code_t code, APa
    using AutoParcelDestroyer = std::unique_ptr<AParcel*, void (*)(AParcel**)>;
    // This object is the input to the transaction. This function takes ownership of it and deletes
    // it.
    AutoParcelDestroyer forIn(in, AParcel_delete);
    AutoParcelDestroyer forIn(in, DestroyParcel);

    if (!isUserCommand(code)) {
        LOG(ERROR) << __func__ << ": Only user-defined transactions can be made from the NDK.";
@@ -492,11 +492,6 @@ AIBinder_DeathRecipient* AIBinder_DeathRecipient_new(
    return new AIBinder_DeathRecipient(onBinderDied);
}

void AIBinder_DeathRecipient_delete(AIBinder_DeathRecipient** recipient) {
    if (recipient == nullptr) {
        return;
    }

    delete *recipient;
    *recipient = nullptr;
void AIBinder_DeathRecipient_delete(AIBinder_DeathRecipient* recipient) {
    delete recipient;
}
+2 −2
Original line number Diff line number Diff line
@@ -300,7 +300,7 @@ __attribute__((warn_unused_result)) AIBinder_Weak* AIBinder_Weak_new(AIBinder* b
/**
 * Deletes the weak reference. This will have no impact on the lifetime of the binder.
 */
void AIBinder_Weak_delete(AIBinder_Weak** weakBinder);
void AIBinder_Weak_delete(AIBinder_Weak* weakBinder);

/**
 * If promotion succeeds, result will have one strong refcount added to it. Otherwise, this returns
@@ -323,7 +323,7 @@ __attribute__((warn_unused_result)) AIBinder_DeathRecipient* AIBinder_DeathRecip
 * Deletes a binder death recipient. It is not necessary to call AIBinder_unlinkToDeath before
 * calling this as these will all be automatically unlinked.
 */
void AIBinder_DeathRecipient_delete(AIBinder_DeathRecipient** recipient);
void AIBinder_DeathRecipient_delete(AIBinder_DeathRecipient* recipient);

__END_DECLS

+2 −2
Original line number Diff line number Diff line
@@ -45,9 +45,9 @@ struct AParcel;
typedef struct AParcel AParcel;

/**
 * Cleans up a parcel and sets it to nullptr.
 * Cleans up a parcel.
 */
void AParcel_delete(AParcel** parcel);
void AParcel_delete(AParcel* parcel);

/**
 * Writes an AIBinder to the next location in a non-null parcel. Can be null.
+1 −1
Original line number Diff line number Diff line
@@ -177,7 +177,7 @@ const char* AStatus_getMessage(const AStatus* status);
/**
 * Deletes memory associated with the status instance.
 */
void AStatus_delete(AStatus** status);
void AStatus_delete(AStatus* status);

__END_DECLS

+2 −7
Original line number Diff line number Diff line
@@ -27,13 +27,8 @@ using ::android::Parcel;
using ::android::sp;
using ::android::status_t;

void AParcel_delete(AParcel** parcel) {
    if (parcel == nullptr) {
        return;
    }

    delete *parcel;
    *parcel = nullptr;
void AParcel_delete(AParcel* parcel) {
    delete parcel;
}

binder_status_t AParcel_writeStrongBinder(AParcel* parcel, AIBinder* binder) {
Loading