X-Git-Url: http://git.tuebingen.mpg.de/?p=osl.git;a=blobdiff_plain;f=log.h;h=2ef82a885a2c43fadc3846080eaeee7e4918d32c;hp=dfb05652a56e6ae35c612bef0a34bb6d6dd81b1b;hb=cc7f7cc534b1b60bad49e99411749cb680aaaf8d;hpb=02e6053e5976c6aa4bf538f3469335835d54e478 diff --git a/log.h b/log.h index dfb0565..2ef82a8 100644 --- a/log.h +++ b/log.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2008 Andre Noll + * Copyright (C) 1997-2009 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -23,9 +23,6 @@ #include #include "gcc-compat.h" -/** compute the maximum of \a a and \a b */ -#define MAX(a,b) ((a) > (b) ? (a) : (b)) - /** debug loglevel, gets really noisy */ #define DEBUG 1 /** still noisy, but won't fill your disk */ @@ -89,41 +86,3 @@ /** \endcond */ __printf_2_3 void __log(int, const char*, ...); - -/** - * Write a log message to a dynamically allocated string. - * - * \param fmt Usual format string. - * \param p Result pointer. - * - * \sa printf(3). */ -#define VSPRINTF(fmt, p) \ -{ \ - int n; \ - size_t size = 100; \ - p = malloc(size); \ - if (p) { \ - while (1) { \ - char *q; \ - va_list ap; \ - /* Try to print in the allocated space. */ \ - va_start(ap, fmt); \ - n = vsnprintf(p, size, fmt, ap); \ - va_end(ap); \ - /* If that worked, return the string. */ \ - if (n > -1 && n < size) \ - break; \ - /* Else try again with more space. */ \ - if (n > -1) /* glibc 2.1 */ \ - size = n + 1; /* precisely what is needed */ \ - else /* glibc 2.0 */ \ - size *= 2; /* twice the old size */ \ - q = realloc(p, size); \ - if (!q) { \ - free(p); \ - p = NULL; \ - break; \ - } \ - } \ - } \ -}