Commit 75fca55c authored by Niels Möller's avatar Niels Möller
Browse files

* src/format.h (lsh_string_cmp, lsh_string_cmp_l): New functions

(don't really belong in this file).

Rev: src/format.c:1.28
Rev: src/format.h:1.22
parent 86f5bff3
......@@ -593,3 +593,23 @@ struct lsh_string *make_cstring(struct lsh_string *s, int free)
return res;
}
/* FIXME: These functions don't really belong here */
int lsh_string_cmp(const struct lsh_string *a, const struct lsh_string *b)
{
if (a->length < b->length)
return -1;
else if (a->length > b->length)
return 1;
else
return memcmp(a->data, b->data, a->length);
}
int lsh_string_cmp_l(const struct lsh_string *a, UINT32 length, const UINT8 *b)
{
if (a->length < length)
return -1;
else if (a->length > length)
return 1;
else
return memcmp(a->data, b, length);
}
......@@ -89,4 +89,8 @@ struct lsh_string *make_cstring(struct lsh_string *s, int free);
unsigned format_size_in_decimal(UINT32 n);
void format_decimal(unsigned length, UINT8 *buffer, UINT32 n);
/* FIXME: This function doesn't really belong here */
int lsh_string_cmp(const struct lsh_string *a, const struct lsh_string *b);
int lsh_string_cmp_l(const struct lsh_string *a, UINT32 length, const UINT8 *b);
#endif /* LSH_FORMAT_H_INCLUDED */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment