Sha256: ae7a0381c31c39d38b01694628b36f9261aa4f3371205b4c24fb7c615f1a1a4e

Contents?: true

Size: 464 Bytes

Versions: 3

Compression:

Stored size: 464 Bytes

Contents

#include <ctype.h>
#include <stddef.h>
#include <stdint.h>

int
yp_strncasecmp(const uint8_t *string1, const uint8_t *string2, size_t length) {
    size_t offset = 0;
    int difference = 0;

    while (offset < length && string1[offset] != '\0') {
        if (string2[offset] == '\0') return string1[offset];
        if ((difference = tolower(string1[offset]) - tolower(string2[offset])) != 0) return difference;
        offset++;
    }

    return difference;
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
yarp-0.12.0 src/util/yp_strncasecmp.c
yarp-0.11.0 src/util/yp_strncasecmp.c
yarp-0.10.0 src/util/yp_strncasecmp.c