]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: Remove function prototypes (cleanup)
authorJakub Narebski <redacted>
Thu, 7 May 2009 17:11:29 +0000 (19:11 +0200)
committerLady <redacted>
Mon, 6 Apr 2026 04:50:38 +0000 (00:50 -0400)
Use of function prototypes is considered bad practice in Perl.  The
ones used here didn't accomplish anything anyhow, so they've been
removed.

>From perlsub(1):

  [...] the intent of this feature [prototypes] is primarily to let
  you define subroutines that work like built-in functions [...]
  you can generate new syntax with it [...]

We don't want to have subroutines behaving exactly like built-in
functions, we don't want to define new syntax / syntactic sugar, so
prototypes in gitweb are not needed... and they can have unintended
consequences.

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index 1bbe41c250f1f1e02b922e11a367cc7caf60b021788e6d8fda26ba0880659bb1..1cfb78e4a47576ad3fe78e4dd7e11624a04a9adb7dc52dc58d0a3ebf1fb3926b 100755 (executable)
@@ -839,7 +839,7 @@ exit;
 ## ======================================================================
 ## action links
 
 ## ======================================================================
 ## action links
 
-sub href (%) {
+sub href {
        my %params = @_;
        # default is to use -absolute url() i.e. $my_uri
        my $href = $params{-full} ? $my_url : $my_uri;
        my %params = @_;
        # default is to use -absolute url() i.e. $my_uri
        my $href = $params{-full} ? $my_url : $my_uri;
@@ -1037,7 +1037,7 @@ sub esc_url {
 }
 
 # replace invalid utf8 character with SUBSTITUTION sequence
 }
 
 # replace invalid utf8 character with SUBSTITUTION sequence
-sub esc_html ($;%) {
+sub esc_html {
        my $str = shift;
        my %opts = @_;
 
        my $str = shift;
        my %opts = @_;
 
@@ -1297,7 +1297,7 @@ use constant {
 };
 
 # submodule/subproject, a commit object reference
 };
 
 # submodule/subproject, a commit object reference
-sub S_ISGITLINK($) {
+sub S_ISGITLINK {
        my $mode = shift;
 
        return (($mode & S_IFMT) == S_IFGITLINK)
        my $mode = shift;
 
        return (($mode & S_IFMT) == S_IFGITLINK)
@@ -2616,7 +2616,7 @@ sub parsed_difftree_line {
 }
 
 # parse line of git-ls-tree output
 }
 
 # parse line of git-ls-tree output
-sub parse_ls_tree_line ($;%) {
+sub parse_ls_tree_line {
        my $line = shift;
        my %opts = @_;
        my %res;
        my $line = shift;
        my %opts = @_;
        my %res;
@@ -3214,7 +3214,6 @@ sub git_print_header_div {
              "\n</div>\n";
 }
 
              "\n</div>\n";
 }
 
-#sub git_print_authorship (\%) {
 sub git_print_authorship {
        my $co = shift;
 
 sub git_print_authorship {
        my $co = shift;
 
@@ -3270,8 +3269,7 @@ sub git_print_page_path {
        print "<br/></div>\n";
 }
 
        print "<br/></div>\n";
 }
 
-# sub git_print_log (\@;%) {
-sub git_print_log ($;%) {
+sub git_print_log {
        my $log = shift;
        my %opts = @_;
 
        my $log = shift;
        my %opts = @_;
 
This page took 0.185086 seconds and 4 git commands to generate.