From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx> 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. --- src/shared/gatt-db.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/shared/gatt-db.c b/src/shared/gatt-db.c index bdce3da47..b5f7094da 100644 --- a/src/shared/gatt-db.c +++ b/src/shared/gatt-db.c @@ -776,20 +776,6 @@ static uint16_t get_handle_at_index(struct gatt_db_service *service, return service->attributes[index]->handle; } -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, @@ -1054,9 +1040,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 * -- 2.20.1