diff options
author | Simon Howard | 2006-01-02 21:02:16 +0000 |
---|---|---|
committer | Simon Howard | 2006-01-02 21:02:16 +0000 |
commit | f65633b5f50be8581ec2de7c06ca9a225d48b82a (patch) | |
tree | a8c4483167cba04f9aae70ac15dafcae8c7d05bc | |
parent | 6b56827d7672aa19f7ce32debb8b207e0bfeb4fb (diff) | |
download | chocolate-doom-f65633b5f50be8581ec2de7c06ca9a225d48b82a.tar.gz chocolate-doom-f65633b5f50be8581ec2de7c06ca9a225d48b82a.tar.bz2 chocolate-doom-f65633b5f50be8581ec2de7c06ca9a225d48b82a.zip |
Change AddrToString function to use an internal static buffer, for
ease of use.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 249
-rw-r--r-- | src/net_io.c | 17 | ||||
-rw-r--r-- | src/net_io.h | 8 |
2 files changed, 20 insertions, 5 deletions
diff --git a/src/net_io.c b/src/net_io.c index b0a56025..e4fb5aae 100644 --- a/src/net_io.c +++ b/src/net_io.c @@ -1,7 +1,7 @@ // Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // -// $Id: net_io.c 229 2005-10-30 19:56:15Z fraggle $ +// $Id: net_io.c 249 2006-01-02 21:02:16Z fraggle $ // // Copyright(C) 2005 Simon Howard // @@ -21,6 +21,10 @@ // 02111-1307, USA. // // $Log$ +// Revision 1.2 2006/01/02 21:02:16 fraggle +// Change AddrToString function to use an internal static buffer, for +// ease of use. +// // Revision 1.1 2005/10/30 19:56:15 fraggle // Add foundation code for the new networking system // @@ -109,9 +113,16 @@ boolean NET_RecvPacket(net_context_t *context, return false; } -void NET_AddrToString(net_addr_t *addr, char *buffer, int buffer_len) +// Note: this prints into a static buffer, calling again overwrites +// the first result + +char *NET_AddrToString(net_addr_t *addr) { - addr->module->AddrToString(addr, buffer, buffer_len); + static char buf[128]; + + addr->module->AddrToString(addr, buf, sizeof(buf) - 1); + + return buf; } void NET_FreeAddress(net_addr_t *addr) diff --git a/src/net_io.h b/src/net_io.h index ca6f1562..7ab14501 100644 --- a/src/net_io.h +++ b/src/net_io.h @@ -1,7 +1,7 @@ // Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // -// $Id: net_io.h 229 2005-10-30 19:56:15Z fraggle $ +// $Id: net_io.h 249 2006-01-02 21:02:16Z fraggle $ // // Copyright(C) 2005 Simon Howard // @@ -21,6 +21,10 @@ // 02111-1307, USA. // // $Log$ +// Revision 1.2 2006/01/02 21:02:16 fraggle +// Change AddrToString function to use an internal static buffer, for +// ease of use. +// // Revision 1.1 2005/10/30 19:56:15 fraggle // Add foundation code for the new networking system // @@ -40,7 +44,7 @@ void NET_AddModule(net_context_t *context, net_module_t *module); void NET_SendPacket(net_addr_t *addr, net_packet_t *packet); boolean NET_RecvPacket(net_context_t *context, net_addr_t **addr, net_packet_t **packet); -void NET_AddrToString(net_addr_t *addr, char *buffer, int buffer_len); +char *NET_AddrToString(net_addr_t *addr); void NET_FreeAddress(net_addr_t *addr); net_addr_t *NET_ResolveAddress(net_context_t *context, char *address); |