X-Git-Url: http://git.tuebingen.mpg.de/?p=adu.git;a=blobdiff_plain;f=adu.h;h=83c3c664daa2fcfc4acea3e40e225834baef4638;hp=42b9471ee251e0ccf28ffd185628bfdd3d315634;hb=61a9284a7dbcffd2a770135d5f2482ae10459ab9;hpb=d0bef44ffe5b6f985f4ba6a718e08afb50f096c6 diff --git a/adu.h b/adu.h index 42b9471..83c3c66 100644 --- a/adu.h +++ b/adu.h @@ -85,6 +85,21 @@ #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. *