Re: [PATCH BlueZ 2/7] shared/gatt-client: Implement bt_gatt_client_register_notify.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Marcel,


>> Without the cast the code will generate a compiler warning, since
>> |descs| is declared as "const bt_descriptor_t *". I'd rather keep it
>> as const since external code will access it but I need the cast to
>> avoid the warning. I could cast it to void* if that makes it shorter.
>
> ouch. We should not be freeing const pointers. If we allocate the pointer, then it should not be const.
>

Yeah, my idea here was that the pointer is allocated internally by
bt_gatt_client and exposed externally as a const pointer. I put the
const there mainly to make it explicit that individual
bt_gatt_descriptor_t entries should not be modified and because I
wanted to avoid yet another nested iterator.

Now that I think of it, I can work around this by keeping the pointer
inside bt_gatt_characteristic_t const and have that point to an
internal non-const parameter in struct chrc_data. This should be OK
since the whole point of struct chrc_data here is to encapsulate
internal variables that should not be accessed or modified externally.

-Arman
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux