Beispiel #1
0
bool
parcBuffer_Equals(const PARCBuffer *x, const PARCBuffer *y)
{
    if (x == y) {
        return true;
    }
    if (x == NULL || y == NULL) {
        return false;
    }

    return (parcBuffer_Compare(x, y) == 0);
}
Beispiel #2
0
int
parcURISegment_Compare(const PARCURISegment *a, const PARCURISegment *b)
{
    if (a == NULL) {
        if (b == NULL) {
            return 0;
        }
        return -1;
    } else {
        if (b == NULL) {
            return +1;
        }
    }

    if (parcURISegment_Length(a) < parcURISegment_Length(b)) {
        return -1;
    }
    if (parcURISegment_Length(a) > parcURISegment_Length(b)) {
        return +1;
    }
    return parcBuffer_Compare(a->buffer, b->buffer);
}
int
ccnxNameSegment_Compare(const CCNxNameSegment *segmentA, const CCNxNameSegment *segmentB)
{
    if (segmentA == NULL) {
        if (segmentB == NULL) {
            return 0;
        }
        return -1;
    } else {
        if (segmentB == NULL) {
            return +1;
        }
    }

    if (ccnxNameSegment_Length(segmentA) < ccnxNameSegment_Length(segmentB)) {
        return -1;
    }
    if (ccnxNameSegment_Length(segmentA) > ccnxNameSegment_Length(segmentB)) {
        return +1;
    }

    int result = parcBuffer_Compare(ccnxNameSegment_GetValue(segmentA), ccnxNameSegment_GetValue(segmentB));
    return result;
}