Skip to content

Commit

Permalink
unix, windows: define UV__INET/6_ADDRSTRLEN constants
Browse files Browse the repository at this point in the history
  • Loading branch information
saghul committed May 25, 2014
1 parent 6d56e6e commit e7b3c3f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/inet.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
#include "uv.h"
#include "uv-common.h"

#define UV__INET_ADDRSTRLEN 16
#define UV__INET6_ADDRSTRLEN 46


static int inet_ntop4(const unsigned char *src, char *dst, size_t size);
static int inet_ntop6(const unsigned char *src, char *dst, size_t size);
Expand All @@ -49,7 +52,7 @@ int uv_inet_ntop(int af, const void* src, char* dst, size_t size) {

static int inet_ntop4(const unsigned char *src, char *dst, size_t size) {
static const char fmt[] = "%u.%u.%u.%u";
char tmp[sizeof "255.255.255.255"];
char tmp[UV__INET_ADDRSTRLEN];
int l;

#ifndef _WIN32
Expand All @@ -74,7 +77,7 @@ static int inet_ntop6(const unsigned char *src, char *dst, size_t size) {
* Keep this in mind if you think this function should have been coded
* to use pointer overlays. All the world's not a VAX.
*/
char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp;
char tmp[UV__INET6_ADDRSTRLEN], *tp;
struct { int base, len; } best, cur;
unsigned int words[sizeof(struct in6_addr) / sizeof(uint16_t)];
int i;
Expand Down

0 comments on commit e7b3c3f

Please sign in to comment.