summaryrefslogtreecommitdiff
path: root/comm
diff options
context:
space:
mode:
authorchatty1994-05-10 09:49:18 +0000
committerchatty1994-05-10 09:49:18 +0000
commit14c468aa6681df233ce2ee885b6cfb51010ef7eb (patch)
tree78c8665f7f6be73a1438e8a9278878d0cb76c182 /comm
parent2d44f1c235029240150361f99c2f349eed62afc4 (diff)
downloadivy-league-14c468aa6681df233ce2ee885b6cfb51010ef7eb.zip
ivy-league-14c468aa6681df233ce2ee885b6cfb51010ef7eb.tar.gz
ivy-league-14c468aa6681df233ce2ee885b6cfb51010ef7eb.tar.bz2
ivy-league-14c468aa6681df233ce2ee885b6cfb51010ef7eb.tar.xz
Removed useless default impl of virtual functions
replaced TRUE/FALSE by true/false
Diffstat (limited to 'comm')
-rw-r--r--comm/Address.cc58
1 files changed, 32 insertions, 26 deletions
diff --git a/comm/Address.cc b/comm/Address.cc
index e86d9bb..af2e1ae 100644
--- a/comm/Address.cc
+++ b/comm/Address.cc
@@ -20,7 +20,21 @@
#include <unistd.h>
#include <stdio.h>
#include <memory.h>
+#ifdef __osf__
+extern "C" {
+#endif
#include <netdb.h>
+#ifdef __osf__
+}
+#endif
+
+#ifdef __osf__
+extern "C" {
+ unsigned short htons (unsigned short);
+ unsigned short ntohs (unsigned short);
+ int gethostname (char*, int);
+}
+#endif
/*?class UchAddress
This class is a virtual base class: no objects of this class are ever created.
@@ -41,7 +55,7 @@ pointed to objects for an automatic reclaim of dynamically allocated objects.
Construct an invalid address.
?*/
UchAddress :: UchAddress ()
-: Valid (FALSE)
+: Valid (false)
{
}
@@ -50,8 +64,16 @@ UchAddress :: ~UchAddress ()
{
}
-// virtual functions for class address
-//
+#ifdef DOC
+// fake entries for inline functions
+
+/*?
+Return true if the address is valid.
+?*/
+bool
+UchAddress :: IsValid ()
+{
+}
/*?
Return one of \var{AF\_UNSPEC}, \var{AF\_UNIX} or \var{AF\_INET}.
@@ -60,14 +82,12 @@ Other values may be defined if supported by the system.
int
UchAddress :: Family ()
{
- return AF_UNSPEC;
}
/*?nextdoc?*/
int
UchAddress :: Length ()
{
- return 0;
}
/*?
@@ -77,16 +97,14 @@ Return the address structure and its length.
SockAddr*
UchAddress :: GetSockAddr ()
{
- return 0;
}
/*?nodoc?*/
char*
UchAddress :: StrRepr (char* buf)
{
- strcpy (buf, "virtual address !");
- return buf;
}
+#endif /* DOC */
#ifdef UNIX_SOCK
@@ -100,7 +118,6 @@ UchAddress :: StrRepr (char* buf)
UchUnixAddress :: UchUnixAddress ()
: UchAddress ()
{
- // nothing
}
/*?
@@ -113,8 +130,9 @@ UchUnixAddress :: UchUnixAddress (const char* filename)
{
Addr.sun_family = AF_UNIX;
strcpy (Addr.sun_path, filename);
- Valid = TRUE; // should check access to file ???
- // unlink if already there ?
+ Valid = true;
+ // should check access to file ???
+ // unlink if already there ?
}
/*?nodoc?*/
@@ -167,7 +185,6 @@ UchUnixAddress :: StrRepr (char* buf)
UchInetAddress :: UchInetAddress ()
: UchAddress ()
{
- // nothing
}
/*?
@@ -180,10 +197,8 @@ If the port number is 0, it will be allocated by the system.
UchInetAddress :: UchInetAddress (const char* name, sword port)
: UchAddress ()
{
- struct hostent *host;
-
if (name && *name) {
- host = gethostbyname (name);
+ struct hostent *host = gethostbyname (name);
if (! host)
return;
memcpy (&Addr.sin_addr, host->h_addr, host->h_length);
@@ -191,7 +206,7 @@ UchInetAddress :: UchInetAddress (const char* name, sword port)
Addr.sin_addr.s_addr = name ? INADDR_LOOPBACK : INADDR_ANY;
Addr.sin_family = AF_INET;
Addr.sin_port = htons (port);
- Valid = TRUE;
+ Valid = true;
}
/*?
@@ -208,7 +223,7 @@ UchInetAddress :: UchInetAddress (lword host, sword port)
Addr.sin_family = AF_INET;
Addr.sin_port = htons (port);
Addr.sin_addr.s_addr = host;
- Valid = TRUE;
+ Valid = true;
}
/*?nodoc?*/
@@ -323,15 +338,6 @@ UchInetAddress :: LoopBack ()
}
#ifdef DOC
-// fake entries for inline functions
-
-/*?
-Return TRUE if the address is valid.
-?*/
-bool
-UchAddress :: IsValid ()
-{}
-
/*?
Return the host number of the address.
?*/