summaryrefslogtreecommitdiff
path: root/src/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 68cc39388..3098f6d68 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -389,3 +389,10 @@ void git_buf_rtrim(git_buf *buf)
buf->ptr[buf->size] = '\0';
}
+
+int git_buf_cmp(const git_buf *a, const git_buf *b)
+{
+ int result = memcmp(a->ptr, b->ptr, min(a->size, b->size));
+ return (result != 0) ? result :
+ (a->size < b->size) ? -1 : (a->size > b->size) ? 1 : 0;
+}