[PATCH 2/4] gitweb: Use capturing parentheses only when you intend to capture

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jakub Narebski
Date: Monday, May 11, 2009 - 10:39 am

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");
 }

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 1/4] gitweb: Replace wrongly added tabs with spaces, Jakub Narebski, (Mon May 11, 10:37 am)
[PATCH 2/4] gitweb: Use capturing parentheses only when yo ..., Jakub Narebski, (Mon May 11, 10:39 am)
Re: [PATCH 3/4] gitweb: Simplify snapshot format detection ..., Giuseppe Bilotta, (Mon May 11, 10:52 am)