bool VendorAttr::autoProtect( const Vendor & vendor_r ) const
{ return( ZConfig::instance().autolock_untrustedvendor() && ! trusted( vendor_r ) ); }
- bool VendorAttr::equivalent( const Vendor & lhs, const Vendor & rhs ) const
+ /** Helper: Lowercase prefix */
+ inline bool hasLcPrefix( const std::string & str_r, const std::string & pref_r )
+ { return str::toLower( str_r.substr( 0, pref_r.size() ) ) == pref_r; }
+
+ /** Helper: SuSE and equivalent vendors */
+ inline bool isSUSE( const Vendor & vnd_r )
{
- static const std::string defSUSE( "suse" );
+ static const std::string defSUSE ( "suse" );
+ static const std::string defopenSUSE( "opensuse" );
- if ( lhs == rhs )
- return true;
- // By now handcrafted equivalence definition:
- if ( str::toLower( lhs.substr( 0, 4 ) ) == defSUSE
- && str::toLower( rhs.substr( 0, 4 ) ) == defSUSE )
+ return( hasLcPrefix( vnd_r, defSUSE )
+ || hasLcPrefix( vnd_r, defopenSUSE ) );
+ }
+
+ bool VendorAttr::equivalent( const Vendor & lhs, const Vendor & rhs ) const
+ {
+ if ( lhs == rhs )
return true;
- return false;
+ // By now handcrafted equivalence definition:
+ return( isSUSE( lhs ) && isSUSE( rhs ) );
}
/////////////////////////////////////////////////////////////////