1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-28 07:51:19 +01:00

gnrc_netapi: declare data for set function as const

This commit is contained in:
Martine Lenders 2018-11-20 11:59:30 +01:00
parent e0e02c04c8
commit 8f5f4a370d
2 changed files with 5 additions and 3 deletions

View File

@ -204,7 +204,7 @@ int gnrc_netapi_get(kernel_pid_t pid, netopt_t opt, uint16_t context,
* wrong.
*/
int gnrc_netapi_set(kernel_pid_t pid, netopt_t opt, uint16_t context,
void *data, size_t data_len);
const void *data, size_t data_len);
#ifdef __cplusplus
}

View File

@ -163,8 +163,10 @@ int gnrc_netapi_get(kernel_pid_t pid, netopt_t opt, uint16_t context,
}
int gnrc_netapi_set(kernel_pid_t pid, netopt_t opt, uint16_t context,
void *data, size_t data_len)
const void *data, size_t data_len)
{
/* disregard const pointer. This *should* be safe and any modification
* to `data` should be considered a bug */
return _get_set(pid, GNRC_NETAPI_MSG_TYPE_SET, opt, context,
data, data_len);
(void *)data, data_len);
}