20.2.235. PMIx_Check_nspace

PMIx_Check_nspace — Compare two pmix_nspace_t(5) values for equality

20.2.235.1. SYNOPSIS

#include <pmix.h>

bool PMIx_Check_nspace(const char *key1, const char *key2);

20.2.235.1.1. Python Syntax

No Python equivalent

20.2.235.2. INPUT PARAMETERS

  • key1: Pointer to the first namespace (typically a pmix_nspace_t(5)) to be compared.

  • key2: Pointer to the second namespace to be compared.

20.2.235.3. DESCRIPTION

Compare two namespaces for equality. The comparison examines at most PMIX_MAX_NSLEN characters, which is the maximum length a pmix_nspace_t can hold.

A wildcard match is applied: if either namespace is invalid (NULL or zero-length, as determined by PMIx_Nspace_invalid(3)), the two are treated as matching and the routine returns true. Otherwise the two strings are compared directly.

20.2.235.4. RETURN VALUE

Returns true if the namespaces are considered equal — that is, if either namespace is invalid, or if their first PMIX_MAX_NSLEN characters match. Returns false when both namespaces are valid and differ.

20.2.235.5. NOTES

PMIx_Check_nspace is an OpenPMIx convenience routine and is the backing implementation of the PMIX_CHECK_NSPACE macro. Because an invalid namespace is treated as a wildcard, this routine is intended for matching semantics rather than a strict byte-for-byte equality test.

That wildcard is easy to inherit by accident. Structures commonly carry namespace fields that are legitimately empty — a parent or launcher that was never recorded, a requestor nobody is waiting on, an object named only later in its lifetime — and comparing one of those here answers true against every namespace in the system. Where the question being asked is “do these two belong to the same namespace” rather than “does this pass the filter”, use PMIx_Check_nspace_strict(3).