From 0f022fce389543404f86824ed6c5720d2502cd09 Mon Sep 17 00:00:00 2001 From: Michael Steinert Date: Fri, 8 Jun 2012 15:38:22 -0600 Subject: Propose new socket API The general idea is to have a non-instantiable socket base class. Connection-specific sub-classes provide a constructor and methods for modifying connection parameters. `amqp_socket_close()` is the destructor. Signed-off-by: Michael Steinert --- examples/utils.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'examples/utils.c') diff --git a/examples/utils.c b/examples/utils.c index 609c354..0830738 100644 --- a/examples/utils.c +++ b/examples/utils.c @@ -34,6 +34,7 @@ * ***** END LICENSE BLOCK ***** */ +#include #include #include #include @@ -45,8 +46,17 @@ #include "utils.h" -void die_on_error(int x, char const *context) +void die(const char *fmt, ...) { + va_list ap; + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fprintf(stderr, "\n"); + exit(1); +} + +void die_on_error(int x, char const *context) { if (x < 0) { char *errstr = amqp_error_string(-x); fprintf(stderr, "%s: %s\n", context, errstr); -- cgit v1.2.1