diff options
author | nijtmans <nijtmans> | 2010-05-17 08:43:58 (GMT) |
---|---|---|
committer | nijtmans <nijtmans> | 2010-05-17 08:43:58 (GMT) |
commit | 1b346366687f1015e9440bd55d61b960aafb3b5f (patch) | |
tree | f00ab26a5c6edc02a389c79fd585beb4b8df33a1 /generic/tkBind.c | |
parent | 7dc0483b667b24907e6a0ed72e10712c7986b8a7 (diff) | |
download | tk-1b346366687f1015e9440bd55d61b960aafb3b5f.zip tk-1b346366687f1015e9440bd55d61b960aafb3b5f.tar.gz tk-1b346366687f1015e9440bd55d61b960aafb3b5f.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; } |