diff options
author | nijtmans <nijtmans> | 2010-05-17 08:43:58 (GMT) |
---|---|---|
committer | nijtmans <nijtmans> | 2010-05-17 08:43:58 (GMT) |
commit | c8ab85ecfd0e2802bb98ab00e67b9acaa01a5577 (patch) | |
tree | f00ab26a5c6edc02a389c79fd585beb4b8df33a1 /generic/tkBind.c | |
parent | ede9fc2f74a2e9aa5084e18c93d903e81f0f3303 (diff) | |
download | tk-c8ab85ecfd0e2802bb98ab00e67b9acaa01a5577.zip tk-c8ab85ecfd0e2802bb98ab00e67b9acaa01a5577.tar.gz tk-c8ab85ecfd0e2802bb98ab00e67b9acaa01a5577.tar.bz2 |
[Patch #2999920]: Optimize Internal Virtual event string operations
[Bug #2987995]: Tk_getOpenFile returns garbage under described circumstances
Diffstat (limited to 'generic/tkBind.c')
-rw-r--r-- | generic/tkBind.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/generic/tkBind.c b/generic/tkBind.c index 27e9a3b..fff2196 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkBind.c,v 1.63 2010/05/10 20:58:18 nijtmans Exp $ + * RCS: @(#) $Id: tkBind.c,v 1.64 2010/05/17 08:44:00 nijtmans Exp $ */ #include "tkInt.h" @@ -3199,9 +3199,7 @@ GetAllVirtualEvents( hPtr = Tcl_FirstHashEntry(&vetPtr->nameTable, &search); for ( ; hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { Tcl_DStringSetLength(&ds, 0); - Tcl_DStringAppend(&ds, "<<", 2); Tcl_DStringAppend(&ds, Tcl_GetHashKey(hPtr->tablePtr, hPtr), -1); - Tcl_DStringAppend(&ds, ">>", 2); Tcl_AppendElement(interp, Tcl_DStringValue(&ds)); } @@ -3919,7 +3917,6 @@ GetVirtualEventUid( Tcl_Interp *interp, char *virtString) { - Tk_Uid uid; size_t length; length = strlen(virtString); @@ -3930,11 +3927,8 @@ GetVirtualEventUid( "\" is badly formed", NULL); return NULL; } - virtString[length - 2] = '\0'; - uid = Tk_GetUid(virtString + 2); - virtString[length - 2] = '>'; - return uid; + return Tk_GetUid(virtString); } /* @@ -4140,7 +4134,7 @@ ParseEventDescription( * event string. */ unsigned long *eventMaskPtr)/* Filled with event mask of matched event. */ { - char *p; + char *p, c; unsigned long eventMask; int count, eventFlags; #define FIELD_SIZE 48 @@ -4227,11 +4221,12 @@ ParseEventDescription( count = 0; goto done; } - *p = '\0'; + c = p[2]; + p[2] = '\0'; patPtr->eventType = VirtualEvent; eventMask = VirtualEventMask; - patPtr->detail.name = Tk_GetUid(field); - *p = '>'; + patPtr->detail.name = Tk_GetUid(field - 2); + p[2] = c; p += 2; goto end; @@ -4446,9 +4441,7 @@ GetPatternString( */ if (patPtr->eventType == VirtualEvent) { - Tcl_DStringAppend(dsPtr, "<<", 2); Tcl_DStringAppend(dsPtr, patPtr->detail.name, -1); - Tcl_DStringAppend(dsPtr, ">>", 2); continue; } |