From owner-svn-src-user@FreeBSD.ORG Wed Aug 31 23:25:07 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1435B1065675; Wed, 31 Aug 2011 23:25:07 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D07328FC22; Wed, 31 Aug 2011 23:25:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7VNP63f021733; Wed, 31 Aug 2011 23:25:06 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7VNP69M021730; Wed, 31 Aug 2011 23:25:06 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201108312325.p7VNP69M021730@svn.freebsd.org> From: Gabor Kovesdan Date: Wed, 31 Aug 2011 23:25:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225302 - in user/gabor/tre-integration: contrib/tre/lib include X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Aug 2011 23:25:07 -0000 Author: gabor Date: Wed Aug 31 23:25:06 2011 New Revision: 225302 URL: http://svn.freebsd.org/changeset/base/225302 Log: - Actually leave pmatch untouched if REG_NOSUB is passed to regcomp() Modified: user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.c user/gabor/tre-integration/include/fastmatch.h Modified: user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.c ============================================================================== --- user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.c Wed Aug 31 23:20:00 2011 (r225301) +++ user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.c Wed Aug 31 23:25:06 2011 (r225302) @@ -384,6 +384,7 @@ static int fastcmp(const void *, const v fg->icase = (cflags & REG_ICASE); \ fg->word = (cflags & REG_WORD); \ fg->newline = (cflags & REG_NEWLINE); \ + fg->nosub = (cflags & REG_NOSUB); \ \ if (n == 0) \ { \ @@ -602,8 +603,11 @@ tre_match_fast(const fastmatch_t *fg, co if (fg->matchall) { - pmatch[0].rm_so = 0; - pmatch[0].rm_eo = len; + if (!fg->nosub) + { + pmatch[0].rm_so = 0; + pmatch[0].rm_eo = len; + } return REG_OK; } @@ -651,8 +655,11 @@ tre_match_fast(const fastmatch_t *fg, co { if (fg->word && !IS_ON_WORD_BOUNDARY) return ret; - pmatch[0].rm_so = j; - pmatch[0].rm_eo = j + (type == STR_WIDE ? fg->wlen : fg->len); + if (!fg->nosub) + { + pmatch[0].rm_so = j; + pmatch[0].rm_eo = j + (type == STR_WIDE ? fg->wlen : fg->len); + } return REG_OK; } } @@ -672,8 +679,11 @@ tre_match_fast(const fastmatch_t *fg, co CHECK_BOL_ANCHOR; if (fg->eol) CHECK_EOL_ANCHOR; - pmatch[0].rm_so = j; - pmatch[0].rm_eo = j + ((type == STR_WIDE) ? fg->wlen : fg->len); + if (!fg->nosub) + { + pmatch[0].rm_so = j; + pmatch[0].rm_eo = j + ((type == STR_WIDE) ? fg->wlen : fg->len); + } return REG_OK; } else if (mismatch > 0) Modified: user/gabor/tre-integration/include/fastmatch.h ============================================================================== --- user/gabor/tre-integration/include/fastmatch.h Wed Aug 31 23:20:00 2011 (r225301) +++ user/gabor/tre-integration/include/fastmatch.h Wed Aug 31 23:25:06 2011 (r225302) @@ -27,6 +27,7 @@ typedef struct { bool word; bool icase; bool newline; + bool nosub; bool matchall; } fastmatch_t;