From cbdc6c0a1c95e7d6cb8836724ef4dbc91ab7ba2c Mon Sep 17 00:00:00 2001 From: hobbs Date: Tue, 11 Dec 2007 03:17:49 +0000 Subject: * generic/tclUtil.c (TclReToGlob): reduce escapes in conversion when not necessary --- ChangeLog | 3 +++ generic/tclUtil.c | 14 ++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index bac7766..a653cab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2007-12-10 Jeff Hobbs + * generic/tclUtil.c (TclReToGlob): reduce escapes in conversion + when not necessary + * generic/tclInt.decls: move TclByteArrayMatch and TclReToGlob * generic/tclIntDecls.h: to tclInt.h from stubs. * generic/tclStubInit.c: Add flags var to TclByteArrayMatch for diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 35efcfd..a6d0e84 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.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: tclUtil.c,v 1.94 2007/12/11 02:57:44 hobbs Exp $ + * RCS: @(#) $Id: tclUtil.c,v 1.95 2007/12/11 03:17:49 hobbs Exp $ */ #include "tclInt.h" @@ -3340,17 +3340,19 @@ TclReToGlob( case 'v': *dsStr++ = '\v'; break; - case 'B': + case 'B': case '\\': *dsStr++ = '\\'; *dsStr++ = '\\'; anchorLeft = 0; /* prevent exact match */ break; - case '\\': case '*': case '+': case '?': - case '{': case '}': case '(': case ')': case '[': case ']': - case '.': case '|': case '^': case '$': + case '*': case '[': case ']': case '?': + /* Only add \ where necessary for glob */ *dsStr++ = '\\'; - *dsStr++ = *p; anchorLeft = 0; /* prevent exact match */ + /* fall through */ + case '{': case '}': case '(': case ')': case '+': + case '.': case '|': case '^': case '$': + *dsStr++ = *p; break; default: msg = "invalid escape sequence"; -- cgit v0.12