From af83f5e55c9dd6aaeda6ae1f14a260dd11f54188 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Mon, 17 Jul 2006 17:56:29 +0000 Subject: Use asprintf() or our implementation of it. CVS patchset: 8133 CVS date: 2006/07/17 17:56:29 --- src/xine-utils/xine_check.c | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/xine-utils/xine_check.c b/src/xine-utils/xine_check.c index c2dcccbdf..7bbf645ff 100644 --- a/src/xine-utils/xine_check.c +++ b/src/xine-utils/xine_check.c @@ -93,33 +93,13 @@ set_hc_result(xine_health_check_t* hc, int state, const char *format, ...) _x_abort(); } - size = strlen(format) + 1; + va_start(args, format); + asprintf (&buf, format, args); + va_end(args); - if (!(buf = xine_xmalloc(size))) + if (!buf) _x_abort(); - while(1) { - va_start(args, format); - n = vsnprintf(buf, size, format, args); - va_end(args); - - if(n > -1 && n < size) { - break; - } - - if(n > -1) { - size = n + 1; - } - else { - size *= 2; - } - - if((buf = realloc(buf, size)) == NULL) { - printf("%s() GASP, realloc() failed\n", __XINE_FUNCTION__); - _x_abort(); - } - } - hc->msg = buf; hc->status = state; } -- cgit v1.2.3