selftest: remove prototypes from some subroutine templates
authorJamie McClymont <jamiemcclymont@catalyst.net.nz>
Thu, 8 Feb 2018 03:51:23 +0000 (16:51 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 21 Feb 2018 01:47:15 +0000 (02:47 +0100)
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 <jamiemcclymont@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
selftest/selftest.pl
selftest/target/Samba3.pm
selftest/target/Samba4.pm

index 0e56e6a13ef13a318c43cec2f0f0653e443fdd0b..64fb9f85d3a5b60f1c3a249e30e4f604a3cdd83d 100755 (executable)
@@ -83,7 +83,7 @@ sub find_in_list($$)
        return undef;
 }
 
-sub skip($)
+sub skip
 {
        my ($name) = @_;
 
index ee7c3be9a9d04a4402b849bcd303a9e966e3457a..fc18954d0fa36599c253632890986f1e202068e4 100755 (executable)
@@ -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) = @_;
 
index 123bf6c3a91e7de3e7f1514007e93765db767eaf..0cd2cf843219773c4436def1b76d1a240e2f54e3 100755 (executable)
@@ -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) = @_;