Kaynağa Gözat

Remove const warnings in totemip code.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1808 fd59a12c-fef9-0310-b244-a6a79926bd2f
Steven Dake 17 yıl önce
ebeveyn
işleme
3b9f70d235
2 değiştirilmiş dosya ile 6 ekleme ve 6 silme
  1. 5 5
      exec/totemip.c
  2. 1 1
      include/corosync/totem/totemip.h

+ 5 - 5
exec/totemip.c

@@ -125,8 +125,8 @@ void totemip_copy_endian_convert(struct totem_ip_address *addr1, struct totem_ip
 int totemip_compare(const void *a, const void *b)
 {
 	int i;
-	struct totem_ip_address *totemip_a = (struct totem_ip_address *)a;
-	struct totem_ip_address *totemip_b = (struct totem_ip_address *)b;
+	const struct totem_ip_address *totemip_a = (const struct totem_ip_address *)a;
+	const struct totem_ip_address *totemip_b = (const struct totem_ip_address *)b;
 	struct in_addr ipv4_a1;
 	struct in_addr ipv4_a2;
 	struct in6_addr ipv6_a1;
@@ -176,7 +176,7 @@ int totemip_compare(const void *a, const void *b)
 /* Build a localhost totem_ip_address */
 int totemip_localhost(int family, struct totem_ip_address *localhost)
 {
-	char *addr_text;
+	const char *addr_text;
 
 	memset (localhost, 0, sizeof (struct totem_ip_address));
 
@@ -206,11 +206,11 @@ int totemip_localhost_check(struct totem_ip_address *addr)
 	return totemip_equal(addr, &localhost);
 }
 
-char *totemip_print(struct totem_ip_address *addr)
+const char *totemip_print(struct totem_ip_address *addr)
 {
 	static char buf[INET6_ADDRSTRLEN];
 
-	return ((char *)inet_ntop(addr->family, addr->addr, buf, sizeof(buf)));
+	return (inet_ntop(addr->family, addr->addr, buf, sizeof(buf)));
 }
 
 /* Make a totem_ip_address into a usable sockaddr_storage */

+ 1 - 1
include/corosync/totem/totemip.h

@@ -67,7 +67,7 @@ extern void totemip_copy(struct totem_ip_address *addr1, struct totem_ip_address
 extern void totemip_copy_endian_convert(struct totem_ip_address *addr1, struct totem_ip_address *addr2);
 int totemip_localhost(int family, struct totem_ip_address *localhost);
 extern int totemip_localhost_check(struct totem_ip_address *addr);
-extern char *totemip_print(struct totem_ip_address *addr);
+extern const char *totemip_print(struct totem_ip_address *addr);
 extern int totemip_sockaddr_to_totemip_convert(struct sockaddr_storage *saddr, struct totem_ip_address *ip_addr);
 extern int totemip_totemip_to_sockaddr_convert(struct totem_ip_address *ip_addr,
 					       uint16_t port, struct sockaddr_storage *saddr, int *addrlen);