Properly namespace twine utility functions

This commit is contained in:
Nick Chambers 2022-06-29 02:12:58 -05:00
parent 48c8e7f92c
commit 2999592c80
3 changed files with 7 additions and 7 deletions

View File

@ -4,8 +4,8 @@
#include <gargoyle/codex.h>
#include <stdint.h>
uint8_t is_sep(char tok);
uint8_t is_eql(char lhs, char rhs);
uint8_t gargoyle_is_sep(char tok);
uint8_t gargoyle_is_eql(char lhs, char rhs);
uint8_t gargoyle_cmp(const char *s1, const char *s2, uint16_t len, gargoyle_flag_type flags);
char *gargoyle_cpy(char *dst, const char *src, uint16_t len, gargoyle_flag_type flags);

View File

@ -27,7 +27,7 @@ struct gargoyle_opt *gargoyle_find_emblem(uint16_t optc, struct gargoyle_opt *op
for(; optc; optc -= 1, optv += 1) {
if(emblem == optv->emblem) {
return optv;
} else if(flags & GARGOYLE_FLG_ECASE && is_eql(emblem, optv->emblem)) {
} else if(flags & GARGOYLE_FLG_ECASE && gargoyle_is_eql(emblem, optv->emblem)) {
return optv;
}
}

View File

@ -2,19 +2,19 @@
#include <gargoyle/codex.h>
#include <gargoyle/twine.h>
uint8_t is_sep(char tok) {
uint8_t gargoyle_is_sep(char tok) {
return (tok == '_' || tok == '-');
}
uint8_t is_eql(char lhs, char rhs) {
uint8_t gargoyle_is_eql(char lhs, char rhs) {
return tolower(lhs) == tolower(rhs);
}
uint8_t gargoyle_cmp(const char *s1, const char *s2, uint16_t len, gargoyle_flag_type flags) {
while(*s1 && *s2 && len) {
if(flags & GARGOYLE_FLG_ICASE && isalpha(*s1) && is_eql(*s1, *s2)) {
if(flags & GARGOYLE_FLG_ICASE && isalpha(*s1) && gargoyle_is_eql(*s1, *s2)) {
s1 += 1, s2 += 1;
} else if(flags & GARGOYLE_FLG_SYMBL && is_sep(*s1) && is_sep(*s2)) {
} else if(flags & GARGOYLE_FLG_SYMBL && gargoyle_is_sep(*s1) && gargoyle_is_sep(*s2)) {
s1 += 1, s2 += 1;
} else if(*s1 == *s2) {
s1 += 1, s2 += 1;