git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Cc: Jakub Narebski <jnareb@gmail.com>
Subject: [PATCH 2/4] gitweb: Use capturing parentheses only when you intend to capture
Date: Mon, 11 May 2009 19:39:43 +0200	[thread overview]
Message-ID: <20090511173733.15152.83661.stgit@localhost.localdomain> (raw)
In-Reply-To: <20090511173025.15152.94215.stgit@localhost.localdomain>

Non-capturing groups are useful because they have better runtime
performance and do not copy strings to the magic global capture
variables.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
"Perl Best Practices", section 12.14. Capturing Parentheses (Use
capturing parentheses only when you intend to capture.)

 gitweb/gitweb.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index beb79ee..097bd18 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -828,7 +828,7 @@ if (!defined $action) {
 if (!defined($actions{$action})) {
 	die_error(400, "Unknown action");
 }
-if ($action !~ m/^(opml|project_list|project_index)$/ &&
+if ($action !~ m/^(?:opml|project_list|project_index)$/ &&
     !$project) {
 	die_error(400, "Project needed");
 }

  parent reply	other threads:[~2009-05-11 17:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-11 17:36 [PATCH 0/4] gitweb: Some code cleanups, part 2 (low hanging fruit) Jakub Narebski
2009-05-11 17:37 ` [PATCH 1/4] gitweb: Replace wrongly added tabs with spaces Jakub Narebski
2009-05-11 17:39 ` Jakub Narebski [this message]
2009-05-11 17:42 ` [PATCH 3/4] gitweb: Simplify snapshot format detection logic in evaluate_path_info Jakub Narebski
2009-05-11 17:52   ` Giuseppe Bilotta
2009-05-11 17:45 ` [PATCH 4/4] gitweb: Remove unused $hash_base parameter from normalize_link_target Jakub Narebski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090511173733.15152.83661.stgit@localhost.localdomain \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).