mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-04-15 23:42:33 +00:00
sntp: use const for servername
This adds const to the sntp servername get/set API and internal storage SNTP's usage of this name is read only and SNTP only passes it to dns_gethostbyname() This was found by compiling with GCC -Wwrite-strings which makes the literal SNTP_SERVER_ADDRESS a const string. This then produced warnings with sntp_init()'s call to sntp_setservername()
This commit is contained in:
parent
60063b98e1
commit
920ee2d07e
@ -228,7 +228,7 @@ static struct udp_pcb *sntp_pcb;
|
||||
/** Names/Addresses of servers */
|
||||
struct sntp_server {
|
||||
#if SNTP_SERVER_DNS
|
||||
char *name;
|
||||
const char *name;
|
||||
#endif /* SNTP_SERVER_DNS */
|
||||
ip_addr_t addr;
|
||||
};
|
||||
@ -796,7 +796,7 @@ sntp_getserver(u8_t idx)
|
||||
* @param dnsserver DNS name of the NTP server to set, to be resolved at contact time
|
||||
*/
|
||||
void
|
||||
sntp_setservername(u8_t idx, char *server)
|
||||
sntp_setservername(u8_t idx, const char *server)
|
||||
{
|
||||
if (idx < SNTP_MAX_SERVERS) {
|
||||
sntp_servers[idx].name = server;
|
||||
@ -810,7 +810,7 @@ sntp_setservername(u8_t idx, char *server)
|
||||
* @return IP address of the indexed NTP server or NULL if the NTP
|
||||
* server has not been configured by name (or at all)
|
||||
*/
|
||||
char *
|
||||
const char *
|
||||
sntp_getservername(u8_t idx)
|
||||
{
|
||||
if (idx < SNTP_MAX_SERVERS) {
|
||||
|
@ -59,8 +59,8 @@ void sntp_setserver(u8_t idx, const ip_addr_t *addr);
|
||||
const ip_addr_t* sntp_getserver(u8_t idx);
|
||||
|
||||
#if SNTP_SERVER_DNS
|
||||
void sntp_setservername(u8_t idx, char *server);
|
||||
char *sntp_getservername(u8_t idx);
|
||||
void sntp_setservername(u8_t idx, const char *server);
|
||||
const char *sntp_getservername(u8_t idx);
|
||||
#endif /* SNTP_SERVER_DNS */
|
||||
|
||||
#if SNTP_GET_SERVERS_FROM_DHCP
|
||||
|
Loading…
x
Reference in New Issue
Block a user