From e4eeed0516b806c6a7b336a9853ac45403475b78 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 4 Dec 2024 17:51:43 +0000 Subject: Indenting --- unix/tclEpollNotfy.c | 2 +- unix/tclKqueueNotfy.c | 2 +- unix/tclLoadDl.c | 8 +-- unix/tclLoadDyld.c | 148 ++++++-------------------------------------------- unix/tclUnixFCmd.c | 83 ++++++++++------------------ unix/tclUnixInit.c | 45 ++------------- unix/tclUnixNotfy.c | 6 +- unix/tclUnixPort.h | 38 +------------ unix/tclUnixTest.c | 4 +- unix/tclUnixTime.c | 2 +- 10 files changed, 69 insertions(+), 269 deletions(-) diff --git a/unix/tclEpollNotfy.c b/unix/tclEpollNotfy.c index 5135525..ea3ba15 100644 --- a/unix/tclEpollNotfy.c +++ b/unix/tclEpollNotfy.c @@ -263,7 +263,7 @@ PlatformEventsControl( * None. * * Side effects: - * While tsdPtr->notifierMutex is held: + * While tsdPtr->notifierMutex is held: * - The per-thread eventfd(2) is closed, if non-zero, and set to -1. * - The per-thread epoll(7) fd is closed, if non-zero, and set to 0. * - The per-thread epoll_event structs are freed, if any, and set to 0. diff --git a/unix/tclKqueueNotfy.c b/unix/tclKqueueNotfy.c index 627fa6e..d0bf479 100644 --- a/unix/tclKqueueNotfy.c +++ b/unix/tclKqueueNotfy.c @@ -262,7 +262,7 @@ PlatformEventsControl( * None. * * Side effects: - * While tsdPtr->notifierMutex is held: + * While tsdPtr->notifierMutex is held: * The per-thread pipe(2) fds are closed, if non-zero, and set to -1. * The per-thread kqueue(2) fd is closed, if non-zero, and set to 0. * The per-thread kevent structs are freed, if any, and set to 0. diff --git a/unix/tclLoadDl.c b/unix/tclLoadDl.c index f0eab5c..14c4327 100644 --- a/unix/tclLoadDl.c +++ b/unix/tclLoadDl.c @@ -88,14 +88,14 @@ TclpDlopen( * Use (RTLD_NOW|RTLD_LOCAL) as default, see [Bug #3216070] */ if (flags & TCL_LOAD_GLOBAL) { - dlopenflags |= RTLD_GLOBAL; + dlopenflags |= RTLD_GLOBAL; } else { - dlopenflags |= RTLD_LOCAL; + dlopenflags |= RTLD_LOCAL; } if (flags & TCL_LOAD_LAZY) { - dlopenflags |= RTLD_LAZY; + dlopenflags |= RTLD_LAZY; } else { - dlopenflags |= RTLD_NOW; + dlopenflags |= RTLD_NOW; } handle = dlopen(native, dlopenflags); if (handle == NULL) { diff --git a/unix/tclLoadDyld.c b/unix/tclLoadDyld.c index 7c35909..1557e5a 100644 --- a/unix/tclLoadDyld.c +++ b/unix/tclLoadDyld.c @@ -20,34 +20,12 @@ #endif /* - * Use preferred dlfcn API on 10.4 and later - */ - -#ifndef TCL_DYLD_USE_DLFCN -# ifdef NO_DLFCN_H -# define TCL_DYLD_USE_DLFCN 0 -# else -# define TCL_DYLD_USE_DLFCN 1 -# endif -#endif - -/* - * Use deprecated NSModule API only to support 10.3 and earlier: - */ - -#ifndef TCL_DYLD_USE_NSMODULE -# define TCL_DYLD_USE_NSMODULE 0 -#endif - -/* * Use includes for the API we're using. */ -#if TCL_DYLD_USE_DLFCN -# include -#endif /* TCL_DYLD_USE_DLFCN */ +#include -#if TCL_DYLD_USE_NSMODULE || defined(TCL_LOAD_FROM_MEMORY) +#if defined(TCL_LOAD_FROM_MEMORY) #if defined (__clang__) || ((__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5)))) #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif @@ -62,20 +40,16 @@ typedef struct Tcl_DyldModuleHandle { struct Tcl_DyldModuleHandle *nextPtr; NSModule module; } Tcl_DyldModuleHandle; -#endif /* TCL_DYLD_USE_NSMODULE || TCL_LOAD_FROM_MEMORY */ +#endif /* TCL_LOAD_FROM_MEMORY */ typedef struct { void *dlHandle; -#if TCL_DYLD_USE_NSMODULE || defined(TCL_LOAD_FROM_MEMORY) +#if defined(TCL_LOAD_FROM_MEMORY) const struct mach_header *dyldLibHeader; Tcl_DyldModuleHandle *modulePtr; #endif } Tcl_DyldLoadHandle; -#if TCL_DYLD_USE_DLFCN || defined(TCL_LOAD_FROM_MEMORY) -MODULE_SCOPE long tclMacOSXDarwinRelease; -#endif - /* * Static functions defined in this file. */ @@ -101,7 +75,7 @@ static void UnloadFile(Tcl_LoadHandle handle); *---------------------------------------------------------------------- */ -#if TCL_DYLD_USE_NSMODULE || defined(TCL_LOAD_FROM_MEMORY) +#if defined(TCL_LOAD_FROM_MEMORY) static const char * DyldOFIErrorMsg( int err) @@ -123,7 +97,7 @@ DyldOFIErrorMsg( return "unknown error"; } } -#endif /* TCL_DYLD_USE_NSMODULE || TCL_LOAD_FROM_MEMORY */ +#endif /* TCL_LOAD_FROM_MEMORY */ /* *---------------------------------------------------------------------- @@ -160,22 +134,15 @@ TclpDlopen( Tcl_DyldLoadHandle *dyldLoadHandle; Tcl_LoadHandle newHandle; void *dlHandle = NULL; -#if TCL_DYLD_USE_NSMODULE || defined(TCL_LOAD_FROM_MEMORY) +#if defined(TCL_LOAD_FROM_MEMORY) const struct mach_header *dyldLibHeader = NULL; Tcl_DyldModuleHandle *modulePtr = NULL; #endif -#if TCL_DYLD_USE_NSMODULE - NSLinkEditErrors editError; - int errorNumber; - const char *errorName, *objFileImageErrMsg = NULL; -#endif /* TCL_DYLD_USE_NSMODULE */ const char *errMsg = NULL; int result; Tcl_DString ds; const char *nativePath, *nativeFileName = NULL; -#if TCL_DYLD_USE_DLFCN int dlopenflags = 0; -#endif /* TCL_DYLD_USE_DLFCN */ /* * First try the full path the user gave us. This is particularly @@ -187,7 +154,6 @@ TclpDlopen( nativeFileName = Tcl_UtfToExternalDString(NULL, Tcl_GetString(pathPtr), TCL_INDEX_NONE, &ds); -#if TCL_DYLD_USE_DLFCN /* * Use (RTLD_NOW|RTLD_LOCAL) as default, see [Bug #3216070] */ @@ -215,79 +181,18 @@ TclpDlopen( errMsg = dlerror(); } } -#endif /* TCL_DYLD_USE_DLFCN */ if (!dlHandle) { -#if TCL_DYLD_USE_NSMODULE - dyldLibHeader = NSAddImage(nativePath, - NSADDIMAGE_OPTION_RETURN_ON_ERROR); - if (!dyldLibHeader) { - NSLinkEditError(&editError, &errorNumber, &errorName, &errMsg); - if (editError == NSLinkEditFileAccessError) { - /* - * The requested file was not found. Let the OS loader examine - * the binary search path for whatever string the user gave us - * which hopefully refers to a file on the binary path. - */ - - dyldLibHeader = NSAddImage(nativeFileName, - NSADDIMAGE_OPTION_WITH_SEARCHING | - NSADDIMAGE_OPTION_RETURN_ON_ERROR); - if (!dyldLibHeader) { - NSLinkEditError(&editError, &errorNumber, &errorName, - &errMsg); - } - } else if ((editError == NSLinkEditFileFormatError - && errorNumber == EBADMACHO) - || editError == NSLinkEditOtherError){ - NSObjectFileImageReturnCode err; - NSObjectFileImage dyldObjFileImage; - NSModule module; - - /* - * The requested file was found but was not of type MH_DYLIB, - * attempt to load it as a MH_BUNDLE. - */ - - err = NSCreateObjectFileImageFromFile(nativePath, - &dyldObjFileImage); - if (err == NSObjectFileImageSuccess && dyldObjFileImage) { - int nsflags = NSLINKMODULE_OPTION_RETURN_ON_ERROR; - if (!(flags & 1)) { - nsflags |= NSLINKMODULE_OPTION_PRIVATE; - } - if (!(flags & 2)) { - nsflags |= NSLINKMODULE_OPTION_BINDNOW; - } - module = NSLinkModule(dyldObjFileImage, nativePath, nsflags); - NSDestroyObjectFileImage(dyldObjFileImage); - if (module) { - modulePtr = (Tcl_DyldModuleHandle *)ckalloc(sizeof(Tcl_DyldModuleHandle)); - modulePtr->module = module; - modulePtr->nextPtr = NULL; - } else { - NSLinkEditError(&editError, &errorNumber, &errorName, - &errMsg); - } - } else { - objFileImageErrMsg = DyldOFIErrorMsg(err); - } - } - } -#endif /* TCL_DYLD_USE_NSMODULE */ } if (dlHandle -#if TCL_DYLD_USE_NSMODULE - || dyldLibHeader || modulePtr -#endif /* TCL_DYLD_USE_NSMODULE */ ) { dyldLoadHandle = (Tcl_DyldLoadHandle *)ckalloc(sizeof(Tcl_DyldLoadHandle)); dyldLoadHandle->dlHandle = dlHandle; -#if TCL_DYLD_USE_NSMODULE || defined(TCL_LOAD_FROM_MEMORY) +#if defined(TCL_LOAD_FROM_MEMORY) dyldLoadHandle->dyldLibHeader = dyldLibHeader; dyldLoadHandle->modulePtr = modulePtr; -#endif /* TCL_DYLD_USE_NSMODULE || TCL_LOAD_FROM_MEMORY */ +#endif /* TCL_LOAD_FROM_MEMORY */ newHandle = (Tcl_LoadHandle)ckalloc(sizeof(*newHandle)); newHandle->clientData = dyldLoadHandle; newHandle->findSymbolProcPtr = &FindSymbol; @@ -302,13 +207,6 @@ TclpDlopen( if (errMsg != NULL) { Tcl_AppendToObj(errObj, errMsg, TCL_INDEX_NONE); } -#if TCL_DYLD_USE_NSMODULE - if (objFileImageErrMsg) { - Tcl_AppendPrintfToObj(errObj, - "\nNSCreateObjectFileImageFromFile() error: %s", - objFileImageErrMsg); - } -#endif /* TCL_DYLD_USE_NSMODULE */ Tcl_SetObjResult(interp, errObj); result = TCL_ERROR; } @@ -347,14 +245,12 @@ FindSymbol( native = Tcl_UtfToExternalDString(NULL, symbol, TCL_INDEX_NONE, &ds); if (dyldLoadHandle->dlHandle) { -#if TCL_DYLD_USE_DLFCN proc = (Tcl_LibraryInitProc *)dlsym(dyldLoadHandle->dlHandle, native); if (!proc) { errMsg = dlerror(); } -#endif /* TCL_DYLD_USE_DLFCN */ } else { -#if TCL_DYLD_USE_NSMODULE || defined(TCL_LOAD_FROM_MEMORY) +#if defined(TCL_LOAD_FROM_MEMORY) NSSymbol nsSymbol = NULL; Tcl_DString newName; @@ -407,7 +303,7 @@ FindSymbol( proc = (Tcl_LibraryInitProc *)NSAddressOfSymbol(nsSymbol); } Tcl_DStringFree(&newName); -#endif /* TCL_DYLD_USE_NSMODULE */ +#endif /* TCL_LOAD_FROM_MEMORY */ } Tcl_DStringFree(&ds); if (errMsg && (interp != NULL)) { @@ -448,11 +344,9 @@ UnloadFile( Tcl_DyldLoadHandle *dyldLoadHandle = (Tcl_DyldLoadHandle *)loadHandle->clientData; if (dyldLoadHandle->dlHandle) { -#if TCL_DYLD_USE_DLFCN (void) dlclose(dyldLoadHandle->dlHandle); -#endif /* TCL_DYLD_USE_DLFCN */ } else { -#if TCL_DYLD_USE_NSMODULE || defined(TCL_LOAD_FROM_MEMORY) +#if defined(TCL_LOAD_FROM_MEMORY) Tcl_DyldModuleHandle *modulePtr = dyldLoadHandle->modulePtr; while (modulePtr != NULL) { @@ -463,7 +357,7 @@ UnloadFile( modulePtr = modulePtr->nextPtr; ckfree(ptr); } -#endif /* TCL_DYLD_USE_NSMODULE */ +#endif /* TCL_LOAD_FROM_MEMORY */ } ckfree(dyldLoadHandle); ckfree(loadHandle); @@ -493,19 +387,13 @@ TclpLoadMemoryGetBuffer( void *buffer = NULL; /* - * NSCreateObjectFileImageFromMemory is available but always fails - * prior to Darwin 7. + * We must allocate the buffer using vm_allocate, because + * NSCreateObjectFileImageFromMemory will dispose of it using + * vm_deallocate. */ - if (tclMacOSXDarwinRelease >= 7) { - /* - * We must allocate the buffer using vm_allocate, because - * NSCreateObjectFileImageFromMemory will dispose of it using - * vm_deallocate. - */ - if (vm_allocate(mach_task_self(), (vm_address_t *) &buffer, size, 1)) { - buffer = NULL; - } + if (vm_allocate(mach_task_self(), (vm_address_t *) &buffer, size, 1)) { + buffer = NULL; } return buffer; } diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c index da14f7e..148974c 100644 --- a/unix/tclUnixFCmd.c +++ b/unix/tclUnixFCmd.c @@ -246,37 +246,13 @@ Realpath( #endif /* PURIFY */ #ifndef NO_REALPATH -#if defined(__APPLE__) && TCL_THREADS && \ - defined(MAC_OS_X_VERSION_MIN_REQUIRED) && \ - MAC_OS_X_VERSION_MIN_REQUIRED < 1030 -/* - * Prior to Darwin 7, realpath is not thread-safe, c.f. Bug 711232; if we - * might potentially be running on pre-10.3 OSX, check Darwin release at - * runtime before using realpath. - */ - -MODULE_SCOPE long tclMacOSXDarwinRelease; -# define haveRealpath (tclMacOSXDarwinRelease >= 7) -#else # define haveRealpath 1 -#endif #endif /* NO_REALPATH */ #ifdef HAVE_FTS #if defined(HAVE_STRUCT_STAT64) && !defined(__APPLE__) /* fts doesn't do stat64 */ # define noFtsStat 1 -#elif defined(__APPLE__) && defined(__LP64__) && \ - defined(MAC_OS_X_VERSION_MIN_REQUIRED) && \ - MAC_OS_X_VERSION_MIN_REQUIRED < 1050 -/* - * Prior to Darwin 9, 64bit fts_open() without FTS_NOSTAT may crash (due to a - * 64bit-unsafe ALIGN macro); if we could be running on pre-10.5 OSX, check - * Darwin release at runtime and do a separate stat() if necessary. - */ - -MODULE_SCOPE long tclMacOSXDarwinRelease; -# define noFtsStat (tclMacOSXDarwinRelease < 9) #else # define noFtsStat 0 #endif @@ -545,7 +521,7 @@ TclUnixCopyFile( int srcFd, dstFd; unsigned blockSize; /* Optimal I/O blocksize for filesystem */ char *buffer; /* Data buffer for copy */ - size_t nread; + ssize_t nread; #ifdef DJGPP #define BINMODE |O_BINARY @@ -601,19 +577,19 @@ TclUnixCopyFile( } buffer = (char *)ckalloc(blockSize); while (1) { - nread = (size_t) read(srcFd, buffer, blockSize); - if ((nread == (size_t) -1) || (nread == 0)) { + nread = read(srcFd, buffer, blockSize); + if ((nread == -1) || (nread == 0)) { break; } - if ((size_t) write(dstFd, buffer, nread) != nread) { - nread = (size_t) -1; + if (write(dstFd, buffer, nread) != nread) { + nread = -1; break; } } ckfree(buffer); close(srcFd); - if ((close(dstFd) != 0) || (nread == (size_t) -1)) { + if ((close(dstFd) != 0) || (nread == -1)) { unlink(dst); /* INTL: Native. */ return TCL_ERROR; } @@ -801,7 +777,7 @@ TclpObjCopyDirectory( * EEXIST: path is a non-empty directory. * EINVAL: path is a root directory. * ENOENT: path doesn't exist or is "". - * ENOTDIR: path is not a directory. + * ENOTDIR: path is not a directory. * * Side effects: * Directory removed. If an error occurs, the error will be returned @@ -938,17 +914,17 @@ TraverseUnixTree( * filled with UTF-8 name of file causing * error. */ int doRewind) /* Flag indicating that to ensure complete - * traversal of source hierarchy, the readdir - * loop should be rewound whenever - * traverseProc has returned TCL_OK; this is - * required when traverseProc modifies the - * source hierarchy, e.g. by deleting - * files. */ + * traversal of source hierarchy, the readdir + * loop should be rewound whenever + * traverseProc has returned TCL_OK; this is + * required when traverseProc modifies the + * source hierarchy, e.g. by deleting + * files. */ { Tcl_StatBuf statBuf; const char *source, *errfile; - int result, sourceLen; - int targetLen; + int result; + int targetLen, sourceLen; #ifndef HAVE_FTS int numProcessed = 0; Tcl_DirEntry *dirEntPtr; @@ -1418,7 +1394,7 @@ GetOwnerAttribute( } else { Tcl_DString ds; - (void) Tcl_ExternalToUtfDString(NULL, pwPtr->pw_name, TCL_INDEX_NONE, &ds); + (void)Tcl_ExternalToUtfDString(NULL, pwPtr->pw_name, TCL_INDEX_NONE, &ds); *attributePtrPtr = Tcl_DStringToObj(&ds); } return TCL_OK; @@ -1640,7 +1616,7 @@ SetPermissionsAttribute( Tcl_Obj *modeObj; TclNewLiteralStringObj(modeObj, "0o"); - Tcl_AppendToObj(modeObj, modeStringPtr+scanned+1, -1); + Tcl_AppendToObj(modeObj, modeStringPtr+scanned+1, TCL_INDEX_NONE); result = Tcl_GetWideIntFromObj(NULL, modeObj, &mode); Tcl_DecrRefCount(modeObj); } @@ -1939,8 +1915,8 @@ TclpObjNormalizePath( { const char *currentPathEndPosition; char cur; - const char *path = TclGetString(pathPtr); - size_t pathLen = pathPtr->length; + Tcl_Size pathLen; + const char *path = TclGetStringFromObj(pathPtr, &pathLen); Tcl_DString ds; const char *nativePath; #ifndef NO_REALPATH @@ -2033,7 +2009,7 @@ TclpObjNormalizePath( if (haveRealpath) { if (nextCheckpoint == 0) { /* - * The path contains at most one component, e.g. '/foo' or '/', so + * The path contains at most one component, e.g. '/foo' or '/', * so there is nothing to resolve. Also, on some platforms * 'Realpath' transforms an empty string into the normalized pwd, * which is the wrong answer. @@ -2044,7 +2020,7 @@ TclpObjNormalizePath( nativePath = Tcl_UtfToExternalDString(NULL, path,nextCheckpoint, &ds); if (Realpath(nativePath, normPath) != NULL) { - int newNormLen; + Tcl_Size newNormLen; wholeStringOk: newNormLen = strlen(normPath); @@ -2060,7 +2036,7 @@ TclpObjNormalizePath( * Uncommenting this would mean that this native filesystem * routine claims the path is normalized if the file exists, * which would permit the caller to avoid iterating through - * other filesystems filesystems. Saving lots of calls is + * other filesystems. Saving lots of calls is * probably worth the extra access() time, but in the common * case that no other filesystems are registered this is an * unnecessary expense. @@ -2163,14 +2139,15 @@ TclUnixOpenTemporaryFile( Tcl_DString templ, tmp; const char *string; int fd; + Tcl_Size length; /* - * We should also check against making more then TMP_MAX of these. + * We should also check against making more than TMP_MAX of these. */ if (dirObj) { - string = TclGetString(dirObj); - Tcl_UtfToExternalDString(NULL, string, dirObj->length, &templ); + string = TclGetStringFromObj(dirObj, &length); + Tcl_UtfToExternalDString(NULL, string, length, &templ); } else { Tcl_DStringInit(&templ); Tcl_DStringAppend(&templ, DefaultTempDir(), TCL_INDEX_NONE); /* INTL: native */ @@ -2179,8 +2156,8 @@ TclUnixOpenTemporaryFile( TclDStringAppendLiteral(&templ, "/"); if (basenameObj) { - string = TclGetString(basenameObj); - Tcl_UtfToExternalDString(NULL, string, basenameObj->length, &tmp); + string = TclGetStringFromObj(basenameObj, &length); + Tcl_UtfToExternalDString(NULL, string, length, &tmp); TclDStringAppendDString(&templ, &tmp); Tcl_DStringFree(&tmp); } else { @@ -2191,8 +2168,8 @@ TclUnixOpenTemporaryFile( #ifdef HAVE_MKSTEMPS if (extensionObj) { - string = TclGetString(extensionObj); - Tcl_UtfToExternalDString(NULL, string, extensionObj->length, &tmp); + string = TclGetStringFromObj(extensionObj, &length); + Tcl_UtfToExternalDString(NULL, string, length, &tmp); TclDStringAppendDString(&templ, &tmp); fd = mkstemps(Tcl_DStringValue(&templ), Tcl_DStringLength(&tmp)); Tcl_DStringFree(&tmp); diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index 199c71f..1c5fd28 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -11,13 +11,6 @@ #include "tclInt.h" #ifdef HAVE_LANGINFO # include -# ifdef __APPLE__ -# if defined(HAVE_WEAK_IMPORT) && MAC_OS_X_VERSION_MIN_REQUIRED < 1030 - /* Support for weakly importing nl_langinfo on Darwin. */ -# define WEAK_IMPORT_NL_LANGINFO - extern char *nl_langinfo(nl_item) WEAK_IMPORT_ATTRIBUTE; -# endif -# endif #endif #include #if defined(__FreeBSD__) && defined(__GNUC__) @@ -321,20 +314,6 @@ static const LocaleTable localeTable[] = { static int MacOSXGetLibraryPath(Tcl_Interp *interp, int maxPathLen, char *tclLibPath); #endif /* HAVE_COREFOUNDATION */ -#if defined(__APPLE__) && (defined(TCL_LOAD_FROM_MEMORY) || ( \ - defined(MAC_OS_X_VERSION_MIN_REQUIRED) && ( \ - (TCL_THREADS && MAC_OS_X_VERSION_MIN_REQUIRED < 1030) || \ - (defined(__LP64__) && MAC_OS_X_VERSION_MIN_REQUIRED < 1050) || \ - (defined(HAVE_COREFOUNDATION) && MAC_OS_X_VERSION_MIN_REQUIRED < 1050)\ - ))) -/* - * Need to check Darwin release at runtime in tclUnixFCmd.c and tclLoadDyld.c: - * initialize release global at startup from uname(). - */ -#define GET_DARWIN_RELEASE 1 -MODULE_SCOPE long tclMacOSXDarwinRelease; -long tclMacOSXDarwinRelease = 0; -#endif /* *--------------------------------------------------------------------------- @@ -422,16 +401,6 @@ TclpInitPlatform(void) */ setlocale(LC_NUMERIC, "C"); - -#ifdef GET_DARWIN_RELEASE - { - struct utsname name; - - if (!uname(&name)) { - tclMacOSXDarwinRelease = strtol(name.release, NULL, 10); - } - } -#endif } /* @@ -477,7 +446,7 @@ TclpInitLibraryPath( if ((str != NULL) && (str[0] != '\0')) { Tcl_DString ds; - int pathc; + Tcl_Size pathc; const char **pathv; char installLib[LIBRARY_SIZE]; @@ -736,7 +705,7 @@ Tcl_GetEncodingNameFromEnvironment( *---------------------------------------------------------------------- */ -#if defined(HAVE_COREFOUNDATION) && MAC_OS_X_VERSION_MAX_ALLOWED > 1020 +#if defined(HAVE_COREFOUNDATION) /* * Helper because whether CFLocaleCopyCurrent and CFLocaleGetIdentifier are * strongly or weakly bound varies by version of OSX, triggering warnings. @@ -771,7 +740,7 @@ InitMacLocaleInfoVar( } CFRelease(localeRef); } -#endif /*defined(HAVE_COREFOUNDATION) && MAC_OS_X_VERSION_MAX_ALLOWED > 1020*/ +#endif /*defined(HAVE_COREFOUNDATION)*/ void TclpSetVariables( @@ -796,9 +765,7 @@ TclpSetVariables( * Set msgcat fallback locale to current CFLocale identifier. */ -#if MAC_OS_X_VERSION_MAX_ALLOWED > 1020 InitMacLocaleInfoVar(CFLocaleCopyCurrent, CFLocaleGetIdentifier, interp); -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED > 1020 */ if (MacOSXGetLibraryPath(interp, MAXPATHLEN, tclLibPath) == TCL_OK) { const char *str; @@ -996,16 +963,16 @@ TclpSetVariables( *---------------------------------------------------------------------- */ -int +Tcl_Size TclpFindVariable( const char *name, /* Name of desired environment variable * (native). */ - int *lengthPtr) /* Used to return length of name (for + Tcl_Size *lengthPtr) /* Used to return length of name (for * successful searches) or number of non-NULL * entries in environ (for unsuccessful * searches). */ { - int i, result = -1; + Tcl_Size i, result = -1; const char *env, *p1, *p2; Tcl_DString envString; diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index 1023db4..a86daed 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -360,12 +360,12 @@ AlertSingleThread( */ if (tsdPtr->prevPtr) { - tsdPtr->prevPtr->nextPtr = tsdPtr->nextPtr; + tsdPtr->prevPtr->nextPtr = tsdPtr->nextPtr; } else { - waitingListPtr = tsdPtr->nextPtr; + waitingListPtr = tsdPtr->nextPtr; } if (tsdPtr->nextPtr) { - tsdPtr->nextPtr->prevPtr = tsdPtr->prevPtr; + tsdPtr->nextPtr->prevPtr = tsdPtr->prevPtr; } tsdPtr->nextPtr = tsdPtr->prevPtr = NULL; tsdPtr->onList = 0; diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index 29506de..5330f4b 100644 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -566,9 +566,7 @@ extern char ** environ; *--------------------------------------------------------------------------- */ -# ifdef HAVE_AVAILABILITYMACROS_H -# include -# endif +# include /* *--------------------------------------------------------------------------- @@ -577,41 +575,11 @@ extern char ** environ; */ # ifdef HAVE_WEAK_IMPORT -# if !defined(HAVE_AVAILABILITYMACROS_H) || !defined(MAC_OS_X_VERSION_MIN_REQUIRED) -# undef HAVE_WEAK_IMPORT -# else -# ifndef WEAK_IMPORT_ATTRIBUTE -# define WEAK_IMPORT_ATTRIBUTE __attribute__((weak_import)) -# endif +# ifndef WEAK_IMPORT_ATTRIBUTE +# define WEAK_IMPORT_ATTRIBUTE __attribute__((weak_import)) # endif # endif /* HAVE_WEAK_IMPORT */ -/* - *--------------------------------------------------------------------------- - * Support for MAC_OS_X_VERSION_MAX_ALLOWED define from AvailabilityMacros.h: - * only use API available in the indicated OS version or earlier. - *--------------------------------------------------------------------------- - */ - -# ifdef MAC_OS_X_VERSION_MAX_ALLOWED -# if MAC_OS_X_VERSION_MAX_ALLOWED < 1050 && defined(__LP64__) -# undef HAVE_COREFOUNDATION -# endif -# if MAC_OS_X_VERSION_MAX_ALLOWED < 1040 -# undef HAVE_OSSPINLOCKLOCK -# undef HAVE_PTHREAD_ATFORK -# undef HAVE_COPYFILE -# endif -# if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 - /* prior to 10.3, realpath is not threadsafe, c.f. bug 711232 */ -# define NO_REALPATH 1 -# undef HAVE_LANGINFO -# endif -# endif /* MAC_OS_X_VERSION_MAX_ALLOWED */ -# if defined(HAVE_COREFOUNDATION) && defined(__LP64__) && \ - defined(HAVE_WEAK_IMPORT) && MAC_OS_X_VERSION_MIN_REQUIRED < 1050 -# warning "Weak import of 64-bit CoreFoundation is not supported, will not run on Mac OS X < 10.5." -# endif /* * For now, test exec-17.1 fails (I/O setup after closing stdout) with * posix_spawnp(), but the classic implementation (based on fork()+execvp()) diff --git a/unix/tclUnixTest.c b/unix/tclUnixTest.c index 4c9ee8d..9974eb3 100644 --- a/unix/tclUnixTest.c +++ b/unix/tclUnixTest.c @@ -547,7 +547,7 @@ TestalarmCmd( * None. * * Side effects: - * Calls the Tcl Async handler. + * Calls the Tcl Async handler. * *---------------------------------------------------------------------- */ @@ -564,7 +564,7 @@ AlarmHandler( * * TestgotsigCmd -- * - * Verify the signal was handled after the testalarm command. + * Verify the signal was handled after the testalarm command. * * Results: * None. diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c index c4f6737..76843ef 100644 --- a/unix/tclUnixTime.c +++ b/unix/tclUnixTime.c @@ -272,7 +272,7 @@ TclpWideClicksToNanoseconds( * and back. * * Results: - * 1 click in microseconds as double. + * 1 click in microseconds as double. * * Side effects: * None. -- cgit v0.12