diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-11-16 10:55:40 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-11-16 10:55:40 (GMT) |
commit | 29606e4a7b43adb9f923fb5781d3b9a93d9ba1c8 (patch) | |
tree | 6cf185a0504de6ff8fa054121bf9d289cfbbc717 /unix | |
parent | ed830e98b74fe64225572a43a9b67e99c2b4d65c (diff) | |
download | tcl-29606e4a7b43adb9f923fb5781d3b9a93d9ba1c8.zip tcl-29606e4a7b43adb9f923fb5781d3b9a93d9ba1c8.tar.gz tcl-29606e4a7b43adb9f923fb5781d3b9a93d9ba1c8.tar.bz2 |
Use more "size_t" in stead of "int" internall. Also eliminate a lot of type-casts which are not necessary any more.
Diffstat (limited to 'unix')
-rw-r--r-- | unix/tclUnixInit.c | 9 | ||||
-rw-r--r-- | unix/tclUnixSock.c | 6 |
2 files changed, 8 insertions, 7 deletions
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index 31177a3..1e35b92 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -453,7 +453,7 @@ TclpInitPlatform(void) void TclpInitLibraryPath( char **valuePtr, - int *lengthPtr, + size_t *lengthPtr, Tcl_Encoding *encodingPtr) { #define LIBRARY_SIZE 32 @@ -542,9 +542,10 @@ TclpInitLibraryPath( Tcl_DStringFree(&buffer); *encodingPtr = Tcl_GetEncoding(NULL, NULL); - str = TclGetStringFromObj(pathPtr, lengthPtr); - *valuePtr = ckalloc((*lengthPtr) + 1); - memcpy(*valuePtr, str, (size_t)(*lengthPtr)+1); + str = TclGetString(pathPtr); + *lengthPtr = pathPtr->length; + *valuePtr = ckalloc(*lengthPtr + 1); + memcpy(*valuePtr, str, *lengthPtr + 1); Tcl_DecrRefCount(pathPtr); } diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index 5d11a28..170aea9 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -203,7 +203,7 @@ void printaddrinfo(struct addrinfo *addrlist, char *prefix) static void InitializeHostName( char **valuePtr, - int *lengthPtr, + size_t *lengthPtr, Tcl_Encoding *encodingPtr) { const char *native = NULL; @@ -271,8 +271,8 @@ InitializeHostName( *encodingPtr = Tcl_GetEncoding(NULL, NULL); *lengthPtr = strlen(native); - *valuePtr = ckalloc((*lengthPtr) + 1); - memcpy(*valuePtr, native, (size_t)(*lengthPtr)+1); + *valuePtr = ckalloc(*lengthPtr + 1); + memcpy(*valuePtr, native, *lengthPtr + 1); } /* |