[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
 | 
					Source: %{name}-%{version}.tar.bz2
 | 
				
			||||||
BuildRequires: pkgconfig(glib-2.0)
 | 
					BuildRequires: pkgconfig(glib-2.0)
 | 
				
			||||||
BuildRequires: pkgconfig(libglibutil)
 | 
					BuildRequires: pkgconfig(libglibutil)
 | 
				
			||||||
BuildRequires: pkgconfig(libgbinder)
 | 
					BuildRequires: pkgconfig(libgbinder) >= 1.0.9
 | 
				
			||||||
 | 
					Requires: libgbinder >= 1.0.9
 | 
				
			||||||
Requires(post): /sbin/ldconfig
 | 
					Requires(post): /sbin/ldconfig
 | 
				
			||||||
Requires(postun): /sbin/ldconfig
 | 
					Requires(postun): /sbin/ldconfig
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -217,14 +217,12 @@ radio_instance_response(
 | 
				
			|||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            /* All other responses have RadioResponseInfo */
 | 
					            /* All other responses have RadioResponseInfo */
 | 
				
			||||||
            GBinderReader reader;
 | 
					            GBinderReader reader;
 | 
				
			||||||
            GBinderBuffer* buf;
 | 
					            const RadioResponseInfo* info;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            gbinder_remote_request_init_reader(req, &reader);
 | 
					            gbinder_remote_request_init_reader(req, &reader);
 | 
				
			||||||
            buf = gbinder_reader_read_buffer(&reader);
 | 
					            info = gbinder_reader_read_hidl_struct(&reader, RadioResponseInfo);
 | 
				
			||||||
            GASSERT(buf && buf->size == sizeof(RadioResponseInfo));
 | 
					            if (info) {
 | 
				
			||||||
            if (buf && buf->size == sizeof(RadioResponseInfo)) {
 | 
					 | 
				
			||||||
                GQuark quark = radio_instance_resp_quark(self, code);
 | 
					                GQuark quark = radio_instance_resp_quark(self, code);
 | 
				
			||||||
                const RadioResponseInfo* info = buf->data;
 | 
					 | 
				
			||||||
                gboolean handled = FALSE;
 | 
					                gboolean handled = FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                g_signal_emit(self,
 | 
					                g_signal_emit(self,
 | 
				
			||||||
@@ -238,7 +236,6 @@ radio_instance_response(
 | 
				
			|||||||
                    radio_instance_ack(self);
 | 
					                    radio_instance_ack(self);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            gbinder_buffer_free(buf);
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        *status = GBINDER_STATUS_OK;
 | 
					        *status = GBINDER_STATUS_OK;
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user