Skip to contentSkip to conversation

Osstest/TestSupport: Hide $ho->{Toolstack} from casual use

PATCH In review Ian Campbell 2 participants 3 messages Jul 31, 2015 – Sep 9, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Osstest/TestSupport: Hide $ho->{Toolstack} from casual use

This should only be accessed via toolstack($ho), which is responsible for caching the value. Rename the field to _Toolstack to deter code from using it.

---
 Osstest/TestSupport.pm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Osstest/TestSupport.pm +3 -3
index 84e86fd..0370129 100644
@@ -2076,11 +2076,11 @@ sub guest_vncsnapshot_stash ($$$$) {
 
 sub toolstack ($) {
     my ($ho) = @_;
-    return $ho->{Toolstack} if $ho->{Toolstack};
+    return $ho->{_Toolstack} if $ho->{_Toolstack};
 
     my $tsname= $r{toolstack} || 'xend';
-    $ho->{Toolstack}= get_host_method_object($ho, 'Toolstack', $tsname);
-    return $ho->{Toolstack};
+    $ho->{_Toolstack}= get_host_method_object($ho, 'Toolstack', $tsname);
+    return $ho->{_Toolstack};
 }
 
 sub authorized_keys () {
Signature · 1 line
2.1.4
Acked-by on v1 1/1
#1 lore raw

Ian Campbell writes ("[PATCH OSSTEST] Osstest/TestSupport: Hide $ho->{Toolstack} from casual use"):

Quoted 3 lines

This should only be accessed via toolstack($ho), which is responsible for caching the value. Rename the field to _Toolstack to deter code from using it.