Example #1
0
/**
 * b1_handle_unref() - release reference
 * @handle:             handle to release reference to, or NULL
 *
 * Release a single reference to an handle. If this is the last reference, the
 * handle is freed.
 *
 * If NULL is passed, this is a no-op.
 *
 * Return: NULL is returned.
 */
_c_public_ B1Handle *b1_handle_unref(B1Handle *handle) {
        if (handle) {
                if (handle->live)
                        c_ref_dec(&handle->ref_kernel, b1_handle_release, handle);
                c_ref_dec(&handle->ref, b1_handle_free, handle);
        }

        return NULL;
}
Example #2
0
File: peer.c Project: bus1/libbus1
/**
 * b1_peer_unref() - release reference
 * @peer:               peer to release reference to, or NULL
 *
 * Return: NULL is returned.
 */
_c_public_ B1Peer *b1_peer_unref(B1Peer *peer) {
        if (peer)
                c_ref_dec(&peer->ref, b1_peer_free, peer);

        return NULL;
}