[gbinder-radio] Optimize radio_instance_response()

... by using gbinder_reader_read_hidl_struct() instead of
gbinder_reader_read_buffer(). The former doesn't allocate
anything - it returns direct pointer to the memory block
associated with the transaction.
This commit is contained in:
Slava Monich
2019-02-22 00:12:17 +02:00
parent 42fc35fbc7
commit bd20f5aabe
2 changed files with 5 additions and 7 deletions

View File

@@ -8,7 +8,8 @@ URL: https://github.com/mer-hybris/libgbinder-radio
Source: %{name}-%{version}.tar.bz2
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(libglibutil)
BuildRequires: pkgconfig(libgbinder)
BuildRequires: pkgconfig(libgbinder) >= 1.0.9
Requires: libgbinder >= 1.0.9
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig

View File

@@ -217,14 +217,12 @@ radio_instance_response(
} else {
/* All other responses have RadioResponseInfo */
GBinderReader reader;
GBinderBuffer* buf;
const RadioResponseInfo* info;
gbinder_remote_request_init_reader(req, &reader);
buf = gbinder_reader_read_buffer(&reader);
GASSERT(buf && buf->size == sizeof(RadioResponseInfo));
if (buf && buf->size == sizeof(RadioResponseInfo)) {
info = gbinder_reader_read_hidl_struct(&reader, RadioResponseInfo);
if (info) {
GQuark quark = radio_instance_resp_quark(self, code);
const RadioResponseInfo* info = buf->data;
gboolean handled = FALSE;
g_signal_emit(self,
@@ -238,7 +236,6 @@ radio_instance_response(
radio_instance_ack(self);
}
}
gbinder_buffer_free(buf);
}
*status = GBINDER_STATUS_OK;
} else {