X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=adu.h;h=adba2c6ac5264452fa532d39604e3458f47b3341;hb=cd5cfb4c2dbbf5615c78d1e439f0cbfb08437b43;hp=83c3c664daa2fcfc4acea3e40e225834baef4638;hpb=e76878bf849caa0916ab39bddb033f9f08dc4242;p=adu.git diff --git a/adu.h b/adu.h index 83c3c66..adba2c6 100644 --- a/adu.h +++ b/adu.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Andre Noll + * Copyright (C) 2008 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -85,51 +85,6 @@ #endif /** \endcond */ -/** - * Wrapper for isspace. - * NetBSD needs this. - */ -/* - * The values should be cast to an unsigned char first, then to int. - * Why? Because the isdigit (as do all other is/to functions/macros) - * expect a number from 0 upto and including 255 as their (int) argument. - * Because char is signed on most systems, casting it to int immediately - * gives the functions an argument between -128 and 127 (inclusive), - * which they will use as an array index, and which will thus fail - * horribly for characters which have their most significant bit set. - */ -#define adu_isspace(c) isspace((int)(unsigned char)(c)) - -/** - * 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 = adu_malloc(size); \ - while (1) { \ - 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 */ \ - p = adu_realloc(p, size); \ - } \ -} - /** Evaluates to 1 if x < y, to -1 if x > y and to 0 if x == y. */ #define NUM_COMPARE(x, y) ((int)((x) < (y)) - (int)((x) > (y)))