Cygwin: move sun_name_t constructors into fhandler_socket_unix.cc
They are only used there anyway and it allows to use the AF_UNIX macro without tweaking header files. While at it, improve both constructors. The default constructor now creates the name of an unnamed socket, the constructor taking parameters carefully checks its input. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
@ -842,18 +842,8 @@ class sun_name_t
|
||||
/* Allows 108 bytes sun_path plus trailing NUL */
|
||||
char _nul[sizeof (struct sockaddr_un) + 1];
|
||||
};
|
||||
sun_name_t ()
|
||||
{
|
||||
un_len = 0;
|
||||
un.sun_family = 0;
|
||||
_nul[sizeof (struct sockaddr_un)] = '\0';
|
||||
}
|
||||
sun_name_t (const struct sockaddr *name, __socklen_t namelen)
|
||||
{
|
||||
un_len = namelen < (__socklen_t) sizeof un ? namelen : sizeof un;
|
||||
memcpy (&un, name, un_len);
|
||||
_nul[sizeof (struct sockaddr_un)] = '\0';
|
||||
}
|
||||
sun_name_t ();
|
||||
sun_name_t (const struct sockaddr *name, __socklen_t namelen);
|
||||
|
||||
void *operator new (size_t) __attribute__ ((nothrow))
|
||||
{ return cmalloc_abort (HEAP_FHANDLER, sizeof (sun_name_t)); }
|
||||
|
Reference in New Issue
Block a user