Helper buffer comparison functions

This commit is contained in:
Wilson Lin 2018-07-05 16:56:49 +12:00
parent 3e5495297b
commit d3113c4047
1 changed files with 10 additions and 0 deletions

View File

@ -181,4 +181,14 @@ hb_eod_char_t hbu_buffer_pop(hbu_buffer_t buf) {
return l;
}
int hbu_buffer_compare(hbu_buffer_t a, hbu_buffer_t b) {
// All buffers have NULL-terminated underlying char arrays
return strcmp(a->data, b->data);
}
int hbu_buffer_equal(hbu_buffer_t a, hbu_buffer_t b) {
return a->length == b->length &&
hbu_buffer_compare(a, b);
}
#endif