Browse Source

MT#55283 convert eq to bool

Change-Id: I62460fe2184aaf8bd6e84957c46274c04bd672c4
pull/1910/head
Richard Fuchs 10 months ago
parent
commit
9808a5f26c
2 changed files with 7 additions and 7 deletions
  1. +6
    -6
      lib/socket.c
  2. +1
    -1
      lib/socket.h

+ 6
- 6
lib/socket.c View File

@ -19,8 +19,8 @@ static bool __ip6_addr_print(const sockaddr_t *a, char *buf, size_t len);
static bool __ip6_addr_print_p(const sockaddr_t *a, char *buf, size_t len);
static unsigned int __ip4_hash(const sockaddr_t *a);
static unsigned int __ip6_hash(const sockaddr_t *a);
static int __ip4_eq(const sockaddr_t *a, const sockaddr_t *b);
static int __ip6_eq(const sockaddr_t *a, const sockaddr_t *b);
static bool __ip4_eq(const sockaddr_t *a, const sockaddr_t *b);
static bool __ip6_eq(const sockaddr_t *a, const sockaddr_t *b);
static bool __ip4_is_specified(const sockaddr_t *a);
static bool __ip6_is_specified(const sockaddr_t *a);
static bool __ip_bind(socket_t *s, unsigned int, const sockaddr_t *);
@ -197,11 +197,11 @@ static unsigned int __ip4_hash(const sockaddr_t *a) {
static unsigned int __ip6_hash(const sockaddr_t *a) {
return in6_addr_hash(&a->ipv6);
}
static int __ip4_eq(const sockaddr_t *a, const sockaddr_t *b) {
return !memcmp(&a->ipv4, &b->ipv4, sizeof(a->ipv4));
static bool __ip4_eq(const sockaddr_t *a, const sockaddr_t *b) {
return memcmp(&a->ipv4, &b->ipv4, sizeof(a->ipv4)) == 0;
}
static int __ip6_eq(const sockaddr_t *a, const sockaddr_t *b) {
return !memcmp(&a->ipv6, &b->ipv6, sizeof(a->ipv6));
static bool __ip6_eq(const sockaddr_t *a, const sockaddr_t *b) {
return memcmp(&a->ipv6, &b->ipv6, sizeof(a->ipv6)) == 0;
}
static bool __ip4_is_specified(const sockaddr_t *a) {
return a->ipv4.s_addr != 0;


+ 1
- 1
lib/socket.h View File

@ -61,7 +61,7 @@ struct socket_family {
const char *rfc_name; /* "IP4" */
const char *unspec_string; /* 0.0.0.0 or :: */
unsigned int (*hash)(const sockaddr_t *);
int (*eq)(const sockaddr_t *, const sockaddr_t *);
bool (*eq)(const sockaddr_t *, const sockaddr_t *);
bool (*addr_parse)(sockaddr_t *, const char *);
bool (*addr_print)(const sockaddr_t *, char *, size_t);
bool (*addr_print_p)(const sockaddr_t *, char *, size_t);


Loading…
Cancel
Save