Implement is_numeric_ipv6() as a state machine

Implement is_numeric_ipv6() as a state machine, so we can avoid
in-place modification.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin 2008-07-30 16:34:44 -07:00
parent 0c6f7f86d3
commit 77fbfeebee
2 changed files with 48 additions and 28 deletions

View file

@ -74,15 +74,11 @@ union sock_addr {
#endif
#ifdef HAVE_IPV6
int is_numeric_ipv6(char *);
int is_numeric_ipv6(const char *);
char *strip_address(char *);
#else
#define is_numeric_ipv6(a) 0
static inline char *strip_address(char *addr)
{
return addr;
}
#define strip_address(a) (a)
#endif
static inline int sa_set_port(union sock_addr *s, u_short port)