summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Wragg <david@rabbitmq.com>2010-10-21 17:49:04 +0100
committerDavid Wragg <david@rabbitmq.com>2010-10-21 17:49:04 +0100
commitf6d629ce5f6c06d48da68eb07326b9bf11c3683a (patch)
treee839b4630dbe41112c3f9098d18ed7069580899c
parent228ea714a8b534854d8d6471969b92c3fec71bcd (diff)
downloadrabbitmq-c-github-ask-f6d629ce5f6c06d48da68eb07326b9bf11c3683a.tar.gz
Eliminate the AMQP_BYTES_FREE macro
It uses a gccism, and is only used in one place where the code can be significantly simplified after inlining the macro.
-rw-r--r--librabbitmq/amqp.h8
-rw-r--r--librabbitmq/amqp_mem.c2
2 files changed, 1 insertions, 9 deletions
diff --git a/librabbitmq/amqp.h b/librabbitmq/amqp.h
index 40c8292..f08990b 100644
--- a/librabbitmq/amqp.h
+++ b/librabbitmq/amqp.h
@@ -292,14 +292,6 @@ extern amqp_bytes_t amqp_bytes_malloc_dup(amqp_bytes_t src);
extern amqp_bytes_t amqp_bytes_malloc(size_t amount);
extern void amqp_bytes_free(amqp_bytes_t bytes);
-#define AMQP_BYTES_FREE(b) \
- ({ \
- if ((b).bytes != NULL) { \
- free((b).bytes); \
- (b).bytes = NULL; \
- } \
- })
-
extern amqp_connection_state_t amqp_new_connection(void);
extern int amqp_get_sockfd(amqp_connection_state_t state);
extern void amqp_set_sockfd(amqp_connection_state_t state,
diff --git a/librabbitmq/amqp_mem.c b/librabbitmq/amqp_mem.c
index 021151a..afe45fb 100644
--- a/librabbitmq/amqp_mem.c
+++ b/librabbitmq/amqp_mem.c
@@ -196,5 +196,5 @@ amqp_bytes_t amqp_bytes_malloc(size_t amount) {
}
void amqp_bytes_free(amqp_bytes_t bytes) {
- AMQP_BYTES_FREE(bytes);
+ free(bytes.bytes);
}