Properly namespace twine utility functions
This commit is contained in:
parent
48c8e7f92c
commit
2999592c80
|
@ -4,8 +4,8 @@
|
||||||
#include <gargoyle/codex.h>
|
#include <gargoyle/codex.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
uint8_t is_sep(char tok);
|
uint8_t gargoyle_is_sep(char tok);
|
||||||
uint8_t is_eql(char lhs, char rhs);
|
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);
|
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);
|
char *gargoyle_cpy(char *dst, const char *src, uint16_t len, gargoyle_flag_type flags);
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ struct gargoyle_opt *gargoyle_find_emblem(uint16_t optc, struct gargoyle_opt *op
|
||||||
for(; optc; optc -= 1, optv += 1) {
|
for(; optc; optc -= 1, optv += 1) {
|
||||||
if(emblem == optv->emblem) {
|
if(emblem == optv->emblem) {
|
||||||
return optv;
|
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;
|
return optv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,19 +2,19 @@
|
||||||
#include <gargoyle/codex.h>
|
#include <gargoyle/codex.h>
|
||||||
#include <gargoyle/twine.h>
|
#include <gargoyle/twine.h>
|
||||||
|
|
||||||
uint8_t is_sep(char tok) {
|
uint8_t gargoyle_is_sep(char tok) {
|
||||||
return (tok == '_' || 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);
|
return tolower(lhs) == tolower(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t gargoyle_cmp(const char *s1, const char *s2, uint16_t len, gargoyle_flag_type flags) {
|
uint8_t gargoyle_cmp(const char *s1, const char *s2, uint16_t len, gargoyle_flag_type flags) {
|
||||||
while(*s1 && *s2 && len) {
|
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;
|
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;
|
s1 += 1, s2 += 1;
|
||||||
} else if(*s1 == *s2) {
|
} else if(*s1 == *s2) {
|
||||||
s1 += 1, s2 += 1;
|
s1 += 1, s2 += 1;
|
||||||
|
|
Loading…
Reference in New Issue