diff options
Diffstat (limited to 'generic/tclNotify.c')
-rw-r--r-- | generic/tclNotify.c | 46 |
1 files changed, 21 insertions, 25 deletions
diff --git a/generic/tclNotify.c b/generic/tclNotify.c index 805845b..e76bca8 100644 --- a/generic/tclNotify.c +++ b/generic/tclNotify.c @@ -13,8 +13,6 @@ * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * RCS: @(#) $Id: tclNotify.c,v 1.26 2008/04/16 14:29:26 das Exp $ */ #include "tclInt.h" @@ -97,7 +95,7 @@ TCL_DECLARE_MUTEX(listLock) */ static void QueueEvent(ThreadSpecificData *tsdPtr, - Tcl_Event* evPtr, Tcl_QueuePosition position); + Tcl_Event *evPtr, Tcl_QueuePosition position); /* *---------------------------------------------------------------------- @@ -183,7 +181,7 @@ TclFinalizeNotifier(void) for (evPtr = tsdPtr->firstEventPtr; evPtr != NULL; ) { hold = evPtr; evPtr = evPtr->nextPtr; - ckfree((char *) hold); + ckfree(hold); } tsdPtr->firstEventPtr = NULL; tsdPtr->lastEventPtr = NULL; @@ -278,7 +276,7 @@ Tcl_CreateEventSource( * checkProc. */ { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - EventSource *sourcePtr = (EventSource *) ckalloc(sizeof(EventSource)); + EventSource *sourcePtr = ckalloc(sizeof(EventSource)); sourcePtr->setupProc = setupProc; sourcePtr->checkProc = checkProc; @@ -299,7 +297,7 @@ Tcl_CreateEventSource( * None. * * Side effects: - * The given event source is cancelled, so its function will never again + * The given event source is canceled, so its function will never again * be called. If no such source exists, nothing happens. * *---------------------------------------------------------------------- @@ -332,7 +330,7 @@ Tcl_DeleteEventSource( } else { prevPtr->nextPtr = sourcePtr->nextPtr; } - ckfree((char *) sourcePtr); + ckfree(sourcePtr); return; } } @@ -355,7 +353,7 @@ Tcl_DeleteEventSource( void Tcl_QueueEvent( - Tcl_Event* evPtr, /* Event to add to queue. The storage space + Tcl_Event *evPtr, /* Event to add to queue. The storage space * must have been allocated the caller with * malloc (ckalloc), and it becomes the * property of the event queue. It will be @@ -364,6 +362,7 @@ Tcl_QueueEvent( * TCL_QUEUE_MARK. */ { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); + QueueEvent(tsdPtr, evPtr, position); } @@ -412,6 +411,8 @@ Tcl_ThreadQueueEvent( if (tsdPtr) { QueueEvent(tsdPtr, evPtr, position); + } else { + ckfree(evPtr); } Tcl_MutexUnlock(&listLock); } @@ -515,14 +516,13 @@ QueueEvent( void Tcl_DeleteEvents( Tcl_EventDeleteProc *proc, /* The function to call. */ - ClientData clientData) /* The type-specific data. */ + ClientData clientData) /* The type-specific data. */ { Tcl_Event *evPtr; /* Pointer to the event being examined */ Tcl_Event *prevPtr; /* Pointer to evPtr's predecessor, or NULL if * evPtr designates the first event in the * queue for the thread. */ - Tcl_Event* hold; - + Tcl_Event *hold; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); Tcl_MutexLock(&(tsdPtr->queueMutex)); @@ -535,7 +535,7 @@ Tcl_DeleteEvents( prevPtr = NULL; evPtr = tsdPtr->firstEventPtr; while (evPtr != NULL) { - if ((*proc)(evPtr, clientData) == 1) { + if (proc(evPtr, clientData) == 1) { /* * This event should be deleted. Unlink it. */ @@ -563,7 +563,7 @@ Tcl_DeleteEvents( hold = evPtr; evPtr = evPtr->nextPtr; - ckfree((char *) hold); + ckfree(hold); } else { /* * Event is to be retained. @@ -667,7 +667,7 @@ Tcl_ServiceEvent( */ Tcl_MutexUnlock(&(tsdPtr->queueMutex)); - result = (*proc)(evPtr, flags); + result = proc(evPtr, flags); Tcl_MutexLock(&(tsdPtr->queueMutex)); if (result) { @@ -702,7 +702,7 @@ Tcl_ServiceEvent( } } if (evPtr) { - ckfree((char *) evPtr); + ckfree(evPtr); } Tcl_MutexUnlock(&(tsdPtr->queueMutex)); return 1; @@ -794,7 +794,7 @@ Tcl_SetServiceMode( void Tcl_SetMaxBlockTime( - Tcl_Time *timePtr) /* Specifies a maximum elapsed time for the + const Tcl_Time *timePtr) /* Specifies a maximum elapsed time for the * next blocking operation in the event * tsdPtr-> */ { @@ -813,11 +813,7 @@ Tcl_SetMaxBlockTime( */ if (!tsdPtr->inTraversal) { - if (tsdPtr->blockTimeSet) { - Tcl_SetTimer(&tsdPtr->blockTime); - } else { - Tcl_SetTimer(NULL); - } + Tcl_SetTimer(&tsdPtr->blockTime); } } @@ -931,7 +927,7 @@ Tcl_DoOneEvent( for (sourcePtr = tsdPtr->firstEventSourcePtr; sourcePtr != NULL; sourcePtr = sourcePtr->nextPtr) { if (sourcePtr->setupProc) { - (sourcePtr->setupProc)(sourcePtr->clientData, flags); + sourcePtr->setupProc(sourcePtr->clientData, flags); } } tsdPtr->inTraversal = 0; @@ -960,7 +956,7 @@ Tcl_DoOneEvent( for (sourcePtr = tsdPtr->firstEventSourcePtr; sourcePtr != NULL; sourcePtr = sourcePtr->nextPtr) { if (sourcePtr->checkProc) { - (sourcePtr->checkProc)(sourcePtr->clientData, flags); + sourcePtr->checkProc(sourcePtr->clientData, flags); } } @@ -1070,13 +1066,13 @@ Tcl_ServiceAll(void) for (sourcePtr = tsdPtr->firstEventSourcePtr; sourcePtr != NULL; sourcePtr = sourcePtr->nextPtr) { if (sourcePtr->setupProc) { - (sourcePtr->setupProc)(sourcePtr->clientData, TCL_ALL_EVENTS); + sourcePtr->setupProc(sourcePtr->clientData, TCL_ALL_EVENTS); } } for (sourcePtr = tsdPtr->firstEventSourcePtr; sourcePtr != NULL; sourcePtr = sourcePtr->nextPtr) { if (sourcePtr->checkProc) { - (sourcePtr->checkProc)(sourcePtr->clientData, TCL_ALL_EVENTS); + sourcePtr->checkProc(sourcePtr->clientData, TCL_ALL_EVENTS); } } |