shared/gatt-db: Remove update_attribute
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Mon, 18 Mar 2019 16:16:06 +0000 (18:16 +0200)
committerhimanshu <h.himanshu@samsung.com>
Tue, 11 Feb 2020 08:57:47 +0000 (14:27 +0530)
It is not longer needed to access the last attribute handle to figure
out its attribute since the handle is either passed directly or the
db->last_handle is used.

Change-Id: I94706812f24868dc0da81a27cc2b1feb36f1f9f1
Signed-off-by: himanshu <h.himanshu@samsung.com>
src/shared/gatt-db.c

index e156c70..d530855 100644 (file)
@@ -781,20 +781,6 @@ static uint16_t get_handle_at_index(struct gatt_db_service *service,
 }
 
 static struct gatt_db_attribute *
-attribute_update(struct gatt_db_service *service, int index)
-{
-       uint16_t previous_handle;
-
-       /* We call this function with index > 0, because index 0 is reserved
-        * for service declaration, and is set in add_service()
-        */
-       previous_handle = service->attributes[index - 1]->handle;
-       service->attributes[index]->handle = previous_handle + 1;
-
-       return service->attributes[index];
-}
-
-static struct gatt_db_attribute *
 service_insert_characteristic(struct gatt_db_service *service,
                                        uint16_t handle,
                                        const bt_uuid_t *uuid,
@@ -1061,9 +1047,10 @@ service_insert_included(struct gatt_db_service *service, uint16_t handle,
         *
         * TODO handle permissions
         */
-       set_attribute_data(service->attributes[index], NULL, NULL, BT_ATT_PERM_READ, NULL);
+       set_attribute_data(service->attributes[index], NULL, NULL,
+                                       BT_ATT_PERM_READ, NULL);
 
-       return attribute_update(service, index);
+       return service->attributes[index];
 }
 
 struct gatt_db_attribute *