mirror of
https://github.com/clearlinux/graphene.git
synced 2026-08-28 21:35:52 +00:00
bd5d56b1a0
These functions are required by the TOML C source code, which will be embedded into Graphene in a future commit.
25 lines
515 B
C
25 lines
515 B
C
/* SPDX-License-Identifier: LGPL-3.0-or-later */
|
|
|
|
#include "api.h"
|
|
|
|
int strcmp(const char* lhs, const char* rhs) {
|
|
while (*lhs == *rhs && *lhs) {
|
|
lhs++;
|
|
rhs++;
|
|
}
|
|
return *(unsigned char*)lhs - *(unsigned char*)rhs;
|
|
}
|
|
|
|
int strncmp(const char* lhs, const char* rhs, size_t maxlen) {
|
|
if (!maxlen)
|
|
return 0;
|
|
|
|
maxlen--;
|
|
while (*lhs == *rhs && *lhs && maxlen) {
|
|
lhs++;
|
|
rhs++;
|
|
maxlen--;
|
|
}
|
|
return *(unsigned char*)lhs - *(unsigned char*)rhs;
|
|
}
|