From 537cae8853115cf55bb33050f8bba3153f4f9c06 Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Sun, 26 May 2013 18:33:08 -0400 Subject: [PATCH] Unroll MIN as the straight ?: construct Considering that not all compilers give us MIN implicitly, and since it's only at one place in the code, losing the MIN shouldn't be too high a price to pay, readability-wise, for portability. --- buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buffer.c b/buffer.c index c94deb1..46ef68b 100644 --- a/buffer.c +++ b/buffer.c @@ -242,7 +242,7 @@ void gh_buf_attach(gh_buf *buf, char *ptr, size_t asize) int gh_buf_cmp(const gh_buf *a, const gh_buf *b) { - int result = memcmp(a->ptr, b->ptr, MIN(a->size, b->size)); + int result = memcmp(a->ptr, b->ptr, a->size < b->size ? a->size : b-> size); return (result != 0) ? result : (a->size < b->size) ? -1 : (a->size > b->size) ? 1 : 0; }