From: Jamie McClymont Date: Thu, 8 Feb 2018 03:51:23 +0000 (+1300) Subject: selftest: remove prototypes from some subroutine templates X-Git-Tag: tevent-0.9.36~58 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=41085ad37de56504467a0014b70f6a708dcde91b;p=thirdparty%2Fsamba.git selftest: remove prototypes from some subroutine templates Rationale, as sent to samba-technical: > Why do you remove the explicit argument declarations for so many functions? > These declarations help catch usage errors, i.e. wrong number of calling > arguments, especially when you add arguments to functions. My understanding is that because these are object methods, the prototypes actually were not providing the checking benefits [see PERLSUB(1) (section "Prototypes")] -- this is evidenced by the fact that some of the prototypes I removed actually had the wrong number of arguments! Now that the subroutines are being dynamically called by function references, the checking also appears not to apply [see the same source]. There was also a more concrete reason: the setup code will automatically set up multiple environment dependencies and pass each of their vars as an individual parameter. Accomplishing this was [seemingly] impossible with the prototypes in place. Additionally, there seems to be a consensus among perl devs that prototypes are generally harmful: see this post (by my colleague) for example: http://www.perlmonks.org/?node_id=406231 Signed-off-by: Jamie McClymont Reviewed-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/selftest/selftest.pl b/selftest/selftest.pl index 0e56e6a13ef..64fb9f85d3a 100755 --- a/selftest/selftest.pl +++ b/selftest/selftest.pl @@ -83,7 +83,7 @@ sub find_in_list($$) return undef; } -sub skip($) +sub skip { my ($name) = @_; diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm index ee7c3be9a9d..fc18954d0fa 100755 --- a/selftest/target/Samba3.pm +++ b/selftest/target/Samba3.pm @@ -204,7 +204,7 @@ sub setup_env($$$) } } -sub setup_nt4_dc($$) +sub setup_nt4_dc { my ($self, $path) = @_; @@ -257,7 +257,7 @@ sub setup_nt4_dc($$) return $vars; } -sub setup_nt4_dc_schannel($$) +sub setup_nt4_dc_schannel { my ($self, $path) = @_; @@ -307,7 +307,7 @@ sub setup_nt4_dc_schannel($$) return $vars; } -sub setup_nt4_member($$$) +sub setup_nt4_member { my ($self, $prefix, $nt4_dc_vars) = @_; my $count = 0; @@ -381,7 +381,7 @@ sub setup_nt4_member($$$) return $ret; } -sub setup_admember($$$$) +sub setup_admember { my ($self, $prefix, $dcvars) = @_; @@ -507,7 +507,7 @@ sub setup_admember($$$$) return $ret; } -sub setup_admember_rfc2307($$$$) +sub setup_admember_rfc2307 { my ($self, $prefix, $dcvars) = @_; @@ -603,7 +603,7 @@ sub setup_admember_rfc2307($$$$) return $ret; } -sub setup_ad_member_idmap_rid($$$$) +sub setup_ad_member_idmap_rid { my ($self, $prefix, $dcvars) = @_; @@ -691,7 +691,7 @@ sub setup_ad_member_idmap_rid($$$$) return $ret; } -sub setup_ad_member_idmap_ad($$$$) +sub setup_ad_member_idmap_ad { my ($self, $prefix, $dcvars) = @_; @@ -780,7 +780,7 @@ sub setup_ad_member_idmap_ad($$$$) return $ret; } -sub setup_simpleserver($$) +sub setup_simpleserver { my ($self, $path) = @_; @@ -834,7 +834,7 @@ sub setup_simpleserver($$) return $vars; } -sub setup_fileserver($$) +sub setup_fileserver { my ($self, $path) = @_; my $prefix_abs = abs_path($path); @@ -1013,7 +1013,7 @@ sub setup_fileserver($$) return $vars; } -sub setup_ktest($$$) +sub setup_ktest { my ($self, $prefix) = @_; @@ -1117,7 +1117,7 @@ $ret->{USERNAME} = KTEST\\Administrator return $ret; } -sub setup_maptoguest($$) +sub setup_maptoguest { my ($self, $path) = @_; diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm index 123bf6c3a91..0cd2cf84321 100755 --- a/selftest/target/Samba4.pm +++ b/selftest/target/Samba4.pm @@ -2169,7 +2169,7 @@ sub setup_env($$$) } } -sub setup_s4member($$$) +sub setup_s4member { my ($self, $path, $dc_vars) = @_; @@ -2186,7 +2186,7 @@ sub setup_s4member($$$) return $env; } -sub setup_s4member_dflt_domain($$$) +sub setup_s4member_dflt_domain { my ($self, $path, $dc_vars) = @_; @@ -2204,7 +2204,7 @@ sub setup_s4member_dflt_domain($$$) return $env; } -sub setup_rpc_proxy($$$) +sub setup_rpc_proxy { my ($self, $path, $dc_vars) = @_; @@ -2220,7 +2220,7 @@ sub setup_rpc_proxy($$$) return $env; } -sub setup_ad_dc_ntvfs($$) +sub setup_ad_dc_ntvfs { my ($self, $path) = @_; @@ -2236,7 +2236,7 @@ sub setup_ad_dc_ntvfs($$) return $env; } -sub setup_chgdcpass($$) +sub setup_chgdcpass { my ($self, $path) = @_; @@ -2251,7 +2251,7 @@ sub setup_chgdcpass($$) return $env; } -sub setup_fl2000dc($$) +sub setup_fl2000dc { my ($self, $path) = @_; @@ -2267,7 +2267,7 @@ sub setup_fl2000dc($$) return $env; } -sub setup_fl2003dc($$$) +sub setup_fl2003dc { my ($self, $path, $dc_vars) = @_; @@ -2285,7 +2285,7 @@ sub setup_fl2003dc($$$) return $env; } -sub setup_fl2008r2dc($$$) +sub setup_fl2008r2dc { my ($self, $path, $dc_vars) = @_; @@ -2309,7 +2309,7 @@ sub setup_fl2008r2dc($$$) return $env; } -sub setup_vampire_dc($$$$) +sub setup_vampire_dc { my ($self, $path, $dc_vars, $fl) = @_; @@ -2385,7 +2385,7 @@ sub setup_vampire_dc($$$$) return $env; } -sub setup_promoted_dc($$$) +sub setup_promoted_dc { my ($self, $path, $dc_vars) = @_; @@ -2428,7 +2428,7 @@ sub setup_promoted_dc($$$) return $env; } -sub setup_subdom_dc($$$) +sub setup_subdom_dc { my ($self, $path, $dc_vars) = @_; @@ -2472,7 +2472,7 @@ sub setup_subdom_dc($$$) return $env; } -sub setup_rodc($$$) +sub setup_rodc { my ($self, $path, $dc_vars) = @_; @@ -2514,7 +2514,7 @@ sub setup_rodc($$$) return $env; } -sub setup_ad_dc($$) +sub setup_ad_dc { my ($self, $path) = @_; @@ -2542,7 +2542,7 @@ sub setup_ad_dc($$) return $env; } -sub setup_ad_dc_no_nss($$) +sub setup_ad_dc_no_nss { my ($self, $path) = @_; @@ -2573,7 +2573,7 @@ sub setup_ad_dc_no_nss($$) return $env; } -sub setup_ad_dc_no_ntlm($$) +sub setup_ad_dc_no_ntlm { my ($self, $path) = @_; @@ -2602,7 +2602,7 @@ sub setup_ad_dc_no_ntlm($$) return $env; } -sub setup_none($$) +sub setup_none { my ($self, $path) = @_;