summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2012-06-12 13:44:14 (GMT)
committerdgp <dgp@users.sourceforge.net>2012-06-12 13:44:14 (GMT)
commit8469cbab159b4bfe007ee77f47b58cccc583561f (patch)
tree4dea90a8aa43adaafc3f38aa7b19123bcc728fd9 /generic
parent7b4a3a11e94026797dfda140a1044ecf9d2871c5 (diff)
downloadtcl-8469cbab159b4bfe007ee77f47b58cccc583561f.zip
tcl-8469cbab159b4bfe007ee77f47b58cccc583561f.tar.gz
tcl-8469cbab159b4bfe007ee77f47b58cccc583561f.tar.bz2
Convert function calls to macros.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclIOUtil.c52
1 files changed, 31 insertions, 21 deletions
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index d9cd66f..f8141ee 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -38,11 +38,16 @@ static void FsAddMountsToGlobResult(Tcl_Obj *resultPtr,
Tcl_Obj *pathPtr, const char *pattern,
Tcl_GlobTypeData *types);
static void FsUpdateCwd(Tcl_Obj *cwdObj, ClientData clientData);
-static void Claim(void);
-static void Disclaim(void);
#ifdef TCL_THREADS
static void FsRecacheFilesystemList(void);
+static void Purge(FilesystemRecord *fsRecPtr);
+
+#define Claim() (tsdPtr->claims++)
+#define Disclaim() if (--tsdPtr->claims <= 0) Purge(tsdPtr->filesystemList);
+#else
+#define Claim()
+#define Disclaim()
#endif
/*
@@ -681,29 +686,16 @@ TclFSEpochOk(
return (filesystemEpoch == tsdPtr->filesystemEpoch);
}
-static void
-Claim()
-{
#ifdef TCL_THREADS
- ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&tclFsDataKey);
-
- tsdPtr->claims++;
-#endif
-}
-
static void
-Disclaim()
+Purge(
+ FilesystemRecord *fsRecPtr)
{
-#ifdef TCL_THREADS
- ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&tclFsDataKey);
- FilesystemRecord *toRelease, *fsRecPtr = tsdPtr->filesystemList;
+ FilesystemRecord *toRelease;
- if (--tsdPtr->claims > 0) {
- return;
- }
/*
- * No claims held, Release all out of date FilesystemRecords from the
- * tsdPtr->filesystemList. First skip the current list.
+ * Release all out of date FilesystemRecords.
+ * First skip the current list.
*/
while (fsRecPtr->fsPtr != &tclNativeFilesystem) {
fsRecPtr = fsRecPtr->nextPtr;
@@ -719,8 +711,8 @@ Disclaim()
}
toRelease = fsRecPtr;
}
-#endif
}
+#endif
/*
* If non-NULL, clientData is owned by us and must be freed later.
@@ -1459,6 +1451,9 @@ TclFSNormalizeToUniquePath(
* for a given filesystem, we can optionally
* return an fs-specific clientdata here. */
{
+#ifdef TCL_THREADS
+ ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&tclFsDataKey);
+#endif
FilesystemRecord *fsRecPtr, *firstFsRecPtr;
/* Ignore this variable */
(void) clientDataPtr;
@@ -3691,6 +3686,9 @@ Tcl_FSLink(
Tcl_Obj*
Tcl_FSListVolumes(void)
{
+#ifdef TCL_THREADS
+ ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&tclFsDataKey);
+#endif
FilesystemRecord *fsRecPtr;
Tcl_Obj *resultPtr = Tcl_NewObj();
@@ -3745,6 +3743,9 @@ FsListMounts(
Tcl_Obj *pathPtr, /* Contains path to directory to search. */
const char *pattern) /* Pattern to match against. */
{
+#ifdef TCL_THREADS
+ ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&tclFsDataKey);
+#endif
FilesystemRecord *fsRecPtr;
Tcl_GlobTypeData mountsOnly = { TCL_GLOB_TYPE_MOUNT, 0, NULL, NULL };
Tcl_Obj *resultPtr = NULL;
@@ -3891,6 +3892,9 @@ TclFSInternalToNormalized(
ClientData clientData,
FilesystemRecord **fsRecPtrPtr)
{
+#ifdef TCL_THREADS
+ ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&tclFsDataKey);
+#endif
FilesystemRecord *fsRecPtr = FsGetFirstFilesystem();
Claim();
@@ -4008,6 +4012,9 @@ TclFSNonnativePathType(
* path, already with a refCount for the
* caller. */
{
+#ifdef TCL_THREADS
+ ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&tclFsDataKey);
+#endif
FilesystemRecord *fsRecPtr;
Tcl_PathType type = TCL_PATH_RELATIVE;
@@ -4468,6 +4475,9 @@ Tcl_Filesystem *
Tcl_FSGetFileSystemForPath(
Tcl_Obj* pathPtr)
{
+#ifdef TCL_THREADS
+ ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&tclFsDataKey);
+#endif
FilesystemRecord *fsRecPtr;
Tcl_Filesystem* retVal = NULL;