int
ss_pers_cmp_(ss_persobj_t *p1, /* First of two objects to compare. This is normally considered to be the
* "haystack". */
ss_persobj_t *p2, /* Second of two objects to compare. This is normally considered to be the
* "needle" and might contain special things like regular expressions, etc.
* depending on the values contained in the MASK. */
const ss_persobj_t *mask /* Which elements of P1 and P2 to compare. This isn't really a true object but
* rather a chunk of memory the same size as the objects that is filled with
* bytes that say which members of P1 and P2 to compare and how to compare
* them. */
)
{
SS_ENTER(ss_pers_cmp_, int);
unsigned persseq; /* Persistent object type sequence number */
int retval=0; /* Return value */
ss_pers_class_t *pc=NULL;
SS_RETVAL(-2); /* Failure return value */
SS_ASSERT_CLASS(p1, ss_persobj_t);
SS_ASSERT_CLASS(p2, ss_persobj_t);
persseq = SS_MAGIC_SEQUENCE(SS_MAGIC_OF(p1));
if (SS_MAGIC_SEQUENCE(SS_MAGIC_OF(p2))!=persseq) SS_ERROR_FMT(USAGE, ("P1 and P2 must be same type"));
SS_ASSERT(mask); /*must be present, but not necessarily a true ss_persobj_t object*/
if (NULL==(pc=SS_PERS_CLASS(SS_MAGIC_SEQUENCE(SS_MAGIC_OF(p1))))) SS_ERROR(FAILED);
if (-2==(retval=ss_val_cmp(p1, p2, mask, pc->valinfo_nused, pc->valinfo))) SS_ERROR(FAILED);
SS_CLEANUP:
SS_LEAVE(retval);
}