From 7f37c6e6520b7e6243133f01b0da5e3ddde73f69 Mon Sep 17 00:00:00 2001
From: Martin Nilsson <nilsson@opera.com>
Date: Mon, 7 Mar 2011 17:41:19 +0100
Subject: [PATCH] A glob always matches itself, so return early if that is the
 case.

---
 src/builtin_functions.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/builtin_functions.c b/src/builtin_functions.c
index 4bb967f0ad..f39f81070c 100644
--- a/src/builtin_functions.c
+++ b/src/builtin_functions.c
@@ -5974,8 +5974,13 @@ static int any_does_match( struct svalue *items, int nglobs, struct pike_string
 {
    INT32 i;
    for( i =0; i<nglobs; i++ )
-    if( does_match(str,0,items[i].u.string,0) )
-         return 1;
+   {
+     struct pike_string *str2 = items[i].u.string;
+     if( str == str2 )
+       return 1;
+     if( does_match(str,0,str2,0) )
+       return 1;
+   }
    return 0;
 } 
 
-- 
GitLab