summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Antonuk <alan.antonuk@gmail.com>2014-12-25 21:03:53 -0800
committerAlan Antonuk <alan.antonuk@gmail.com>2015-05-05 20:54:16 -0700
commitba9d8ba48fa099a0430584e1e92fe14d8b8ab3c0 (patch)
tree05f6638f08707bb24f07cd4059ef4186bcba7ecc
parent3546a7072cfc2a5b13194fe13378c4817d40dcb4 (diff)
downloadrabbitmq-c-ba9d8ba48fa099a0430584e1e92fe14d8b8ab3c0.tar.gz
Add amqp_bytes_equal comparison function.
-rw-r--r--librabbitmq/amqp_mem.c8
-rw-r--r--librabbitmq/amqp_private.h2
2 files changed, 10 insertions, 0 deletions
diff --git a/librabbitmq/amqp_mem.c b/librabbitmq/amqp_mem.c
index 586117e..9c8f413 100644
--- a/librabbitmq/amqp_mem.c
+++ b/librabbitmq/amqp_mem.c
@@ -250,3 +250,11 @@ amqp_pool_t *amqp_get_channel_pool(amqp_connection_state_t state, amqp_channel_t
return NULL;
}
+
+int amqp_bytes_equal(amqp_bytes_t r, amqp_bytes_t l) {
+ if (r.len == l.len &&
+ (r.bytes == l.bytes || 0 == memcmp(r.bytes, l.bytes, r.len))) {
+ return 1;
+ }
+ return 0;
+}
diff --git a/librabbitmq/amqp_private.h b/librabbitmq/amqp_private.h
index 9497cc8..80bcfe0 100644
--- a/librabbitmq/amqp_private.h
+++ b/librabbitmq/amqp_private.h
@@ -366,4 +366,6 @@ AMQP_NORETURN
void
amqp_abort(const char *fmt, ...);
+int amqp_bytes_equal(amqp_bytes_t r, amqp_bytes_t l);
+
#endif