15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#include "tclInt.h"
#ifdef TCL_THREADS
#include "pthread.h"
typedef struct ThreadSpecificData {
char nabuf[16];
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
/*
* masterLock is used to serialize creation of mutexes, condition variables,
* and thread local storage. This is the only place that can count on the
|
|
|
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#include "tclInt.h"
#ifdef TCL_THREADS
#include "pthread.h"
typedef struct ThreadSpecificData {
char nabuf[17];
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
/*
* masterLock is used to serialize creation of mutexes, condition variables,
* and thread local storage. This is the only place that can count on the
|
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
|
char *
TclpInetNtoa(
struct in_addr addr)
{
#ifdef TCL_THREADS
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
char *b = (char*) &addr.s_addr;
sprintf(tsdPtr->nabuf, "%u.%u.%u.%u", b[0], b[1], b[2], b[3]);
return tsdPtr->nabuf;
#else
return inet_ntoa(addr);
#endif
}
|
|
|
|
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
|
char *
TclpInetNtoa(
struct in_addr addr)
{
#ifdef TCL_THREADS
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
unsigned char *b = (unsigned char*) &addr.s_addr;
sprintf(tsdPtr->nabuf, "%u.%u.%u.%u", b[0], b[1], b[2], b[3]);
return tsdPtr->nabuf;
#else
return inet_ntoa(addr);
#endif
}
|