[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:
		@@ -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
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user