@matheusbsbs / matheus-bagliano / commits / c42b00c8f2
Fork 0

gitweb: Use nonlocal jump instead of 'exit' in die_error

Use 'goto DONE' in place of 'exit' to end request processing in die_error() subroutine. While at it, do not end gitweb with 'exit'. This would make it easier in the future to add support or improve support for persistent environments such as FastCGI and mod_perl. It would also make it easier to make use of die_error() as an error handler (for fatalsToBrowser). Perl 5 allows non-local jumps; the restriction is that you cannot jump into a scope. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Acked-by: Petr Baudis <pasky@suse.cz> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jakub Narebski committed Apr 24, 2010 at 15:56 UTC c42b00c8f2b8c04ff9829e88dcde92d7294cd460
1 file changed +3 -2
gitweb/gitweb.perl
+3 -2
@@ -972,7 +972,8 @@ if ($action !~ m/^(?:opml|project_list|project_index)$/ &&
972 die_error(400, "Project needed");
973 }
974 $actions{$action}->();
975 -exit;
975 +DONE_GITWEB:
976 +1;
977
978 ## ======================================================================
979 ## action links
@@ -3432,7 +3433,7 @@ EOF
3433 print "</div>\n";
3434
3435 git_footer_html();
3435 - exit;
3436 + goto DONE_GITWEB;
3437 }
3438
3439 ## ----------------------------------------------------------------------