The attached patch adds "const" in front of parameters that deserve it, in
ip_addr.*.
Luca
Index: src/core/ipv4/ip_addr.c
===================================================================
--- src/core/ipv4/ip_addr.c (revision 3079)
+++ src/core/ipv4/ip_addr.c (working copy)
@@ -51,7 +51,7 @@
* @param netif the network interface against which the address is checked
* @return returns non-zero if the address is a broadcast address
*/
-u8_t ip_addr_isbroadcast(ip_addr_t *addr, struct netif *netif)
+u8_t ip_addr_isbroadcast(const ip_addr_t *addr, const struct netif *netif)
{
u32_t addr2test;
@@ -220,7 +220,7 @@
* represenation of addr
*/
char *
-ipaddr_ntoa(ip_addr_t *addr)
+ipaddr_ntoa(const ip_addr_t *addr)
{
static char str[16];
return ipaddr_ntoa_r(addr, str, 16);
@@ -235,7 +235,7 @@
* @return either pointer to buf which now holds the ASCII
* representation of addr or NULL if buf was too small
*/
-char *ipaddr_ntoa_r(ip_addr_t *addr, char *buf, int buflen)
+char *ipaddr_ntoa_r(const ip_addr_t *addr, char *buf, int buflen)
{
u32_t s_addr;
char inv[3];
Index: src/include/ipv4/lwip/ip_addr.h
===================================================================
--- src/include/ipv4/lwip/ip_addr.h (revision 3079)
+++ src/include/ipv4/lwip/ip_addr.h (working copy)
@@ -181,7 +181,7 @@
#define ip_addr_isany(addr1) ((addr1) == NULL || (addr1)->addr == IPADDR_ANY)
-u8_t ip_addr_isbroadcast(ip_addr_t *, struct netif *);
+u8_t ip_addr_isbroadcast(const ip_addr_t *, const struct netif *);
#define ip_addr_ismulticast(addr1) (((addr1)->addr & ntohl(0xf0000000UL)) == ntohl(0xe0000000UL))
@@ -212,8 +212,8 @@
u32_t ipaddr_addr(const char *cp);
int ipaddr_aton(const char *cp, ip_addr_t *addr);
/** returns ptr to static buffer; not reentrant! */
-char *ipaddr_ntoa(ip_addr_t *addr);
-char *ipaddr_ntoa_r(ip_addr_t *addr, char *buf, int buflen);
+char *ipaddr_ntoa(const ip_addr_t *addr);
+char *ipaddr_ntoa_r(const ip_addr_t *addr, char *buf, int buflen);
#ifdef __cplusplus
}
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users