forked from GitHub/gf-core
added order and equality for strings in libgu
This commit is contained in:
@@ -421,6 +421,17 @@ gu_string_eq(GuString s1, GuString s2)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
gu_string_eq_fn(GuEquality* self, const void* p1, const void* p2)
|
||||||
|
{
|
||||||
|
(void) self;
|
||||||
|
const GuString* sp1 = p1;
|
||||||
|
const GuString* sp2 = p2;
|
||||||
|
return gu_string_eq(*sp1, *sp2);
|
||||||
|
}
|
||||||
|
|
||||||
|
GuEquality gu_string_equality[1] = { { gu_string_eq_fn } };
|
||||||
|
|
||||||
int
|
int
|
||||||
gu_string_cmp(GuString s1, GuString s2)
|
gu_string_cmp(GuString s1, GuString s2)
|
||||||
{
|
{
|
||||||
@@ -478,6 +489,17 @@ gu_string_cmp(GuString s1, GuString s2)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
gu_string_cmp_fn(GuOrder* self, const void* p1, const void* p2)
|
||||||
|
{
|
||||||
|
(void) self;
|
||||||
|
const GuString* sp1 = p1;
|
||||||
|
const GuString* sp2 = p2;
|
||||||
|
return gu_string_cmp(*sp1, *sp2);
|
||||||
|
}
|
||||||
|
|
||||||
|
GuOrder gu_string_order[1] = { { gu_string_cmp_fn } };
|
||||||
|
|
||||||
static GuHash
|
static GuHash
|
||||||
gu_string_hasher_hash(GuHasher* self, const void* p)
|
gu_string_hasher_hash(GuHasher* self, const void* p)
|
||||||
{
|
{
|
||||||
@@ -486,15 +508,6 @@ gu_string_hasher_hash(GuHasher* self, const void* p)
|
|||||||
return gu_string_hash(0, *sp);
|
return gu_string_hash(0, *sp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
|
||||||
gu_string_eq_fn(GuEquality* self, const void* p1, const void* p2)
|
|
||||||
{
|
|
||||||
(void) self;
|
|
||||||
const GuString* sp1 = p1;
|
|
||||||
const GuString* sp2 = p2;
|
|
||||||
return gu_string_eq(*sp1, *sp2);
|
|
||||||
}
|
|
||||||
|
|
||||||
GuHasher gu_string_hasher[1] = {
|
GuHasher gu_string_hasher[1] = {
|
||||||
{
|
{
|
||||||
.eq = { gu_string_eq_fn },
|
.eq = { gu_string_eq_fn },
|
||||||
|
|||||||
@@ -81,6 +81,19 @@ gu_string_is_prefix(GuString s1, GuString s2);
|
|||||||
|
|
||||||
#endif // GU_STRING_H_
|
#endif // GU_STRING_H_
|
||||||
|
|
||||||
|
#if defined(GU_FUN_H_) && !defined(GU_STRING_H_FUN_)
|
||||||
|
#define GU_STRING_H_FUN_
|
||||||
|
bool
|
||||||
|
gu_string_eq(GuString s1, GuString s2);
|
||||||
|
|
||||||
|
extern GuEquality gu_string_equality[1];
|
||||||
|
|
||||||
|
int
|
||||||
|
gu_string_cmp(GuString s1, GuString s2);
|
||||||
|
|
||||||
|
extern GuOrder gu_string_order[1];
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(GU_HASH_H_) && !defined(GU_STRING_H_HASH_)
|
#if defined(GU_HASH_H_) && !defined(GU_STRING_H_HASH_)
|
||||||
#define GU_STRING_H_HASH_
|
#define GU_STRING_H_HASH_
|
||||||
|
|
||||||
@@ -88,12 +101,6 @@ GuHash
|
|||||||
gu_string_hash(GuHash h, GuString s);
|
gu_string_hash(GuHash h, GuString s);
|
||||||
|
|
||||||
extern GuHasher gu_string_hasher[1];
|
extern GuHasher gu_string_hasher[1];
|
||||||
|
|
||||||
bool
|
|
||||||
gu_string_eq(GuString s1, GuString s2);
|
|
||||||
|
|
||||||
int
|
|
||||||
gu_string_cmp(GuString s1, GuString s2);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef GU_TYPE_H_
|
#ifdef GU_TYPE_H_
|
||||||
|
|||||||
Reference in New Issue
Block a user