Simplify and factorize compareNamespace utility

Signed-off-by: Olivier Monnier <olivier.monnier@intel.com>