M src/sa/sa.c => src/sa/sa.c +1 -1
@@ 31,7 31,7 @@ sa_alloc_from_ipv6_address_and_port(struct in6_addr in6_addr, in_port_t in_port)
union sa_address *
-sa_alloc_from_unix_path(char const *path)
+sa_alloc_from_local_path(char const *path)
{
if (!path) return NULL;
if (strlen(path) >= UNIX_PATH_MAX) return NULL;
M src/sa/sa.h => src/sa/sa.h +6 -2
@@ 27,7 27,11 @@
/* The `sa_address` union holds storage for each of the `sockaddr`
[type puns](https://en.wikipedia.org/wiki/Type_punning) along with space for
a string representation. For the `sockaddr_un` address type, the `sun_path`
- field is used as the string representation. */
+ field is used as the string representation.
+
+ Because the symbol `unix` is #defined in some Unix C compilers, `sa_address`
+ uses the name `local` to refer to Unix domain sockets, which are sometimes
+ referred to as "local" sockets. */
union sa_address {
struct sockaddr generic;
struct {
@@ 52,7 56,7 @@ union sa_address *
sa_alloc_from_ipv6_address_and_port(struct in6_addr in6_addr, in_port_t in_port);
union sa_address *
-sa_alloc_from_unix_path(char const *path);
+sa_alloc_from_local_path(char const *path);
// # Allocate socket address from a `sockaddr`-type struct.
M src/sa/sa_tests.c => src/sa/sa_tests.c +10 -10
@@ 47,9 47,9 @@ test_sa_alloc_from_ipv6_address_and_port(void)
static void
-test_sa_alloc_from_unix_path(void)
+test_sa_alloc_from_local_path(void)
{
- union sa_address *address = sa_alloc_from_unix_path("/var/dood/http");
+ union sa_address *address = sa_alloc_from_local_path("/var/dood/http");
assert(address);
assert(AF_UNIX == address->generic.sa_family);
@@ 65,21 65,21 @@ test_sa_alloc_from_unix_path(void)
static void
-test_sa_alloc_from_path_when_null(void)
+test_sa_alloc_from_local_path_when_null(void)
{
- union sa_address *address = sa_alloc_from_unix_path(NULL);
+ union sa_address *address = sa_alloc_from_local_path(NULL);
assert(!address);
}
static void
-test_sa_alloc_from_path_when_too_long(void)
+test_sa_alloc_from_local_path_when_too_long(void)
{
char const *too_long = "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789";
assert(strlen(too_long) > UNIX_PATH_MAX);
- union sa_address *address = sa_alloc_from_unix_path(too_long);
+ union sa_address *address = sa_alloc_from_local_path(too_long);
assert(!address);
}
@@ 198,7 198,7 @@ test_sa_len_for_ipv6(void)
static void
test_sa_len_for_unix(void)
{
- union sa_address *address = sa_alloc_from_unix_path("/var/dood/http");
+ union sa_address *address = sa_alloc_from_local_path("/var/dood/http");
assert(sizeof(struct sockaddr_un) == sa_len(address));
@@ 250,9 250,9 @@ main(int argc, char *argv[])
{
test_sa_alloc_from_ipv4_address_and_port();
test_sa_alloc_from_ipv6_address_and_port();
- test_sa_alloc_from_unix_path();
- test_sa_alloc_from_path_when_null();
- test_sa_alloc_from_path_when_too_long();
+ test_sa_alloc_from_local_path();
+ test_sa_alloc_from_local_path_when_null();
+ test_sa_alloc_from_local_path_when_too_long();
test_sa_alloc_from_sockaddr_in();
test_sa_alloc_from_sockaddr_in6();