From: ellson Date: Mon, 9 Mar 2009 18:16:00 +0000 (+0000) Subject: avoid long list of systems with ferror macros X-Git-Tag: LAST_LIBGRAPH~32^2~2303 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bbc9a4e899a86950ee50309d5f21caba6bd06529;p=graphviz avoid long list of systems with ferror macros --- diff --git a/lib/graph/graphio.c b/lib/graph/graphio.c index ebd1994e7..454e84a62 100644 --- a/lib/graph/graphio.c +++ b/lib/graph/graphio.c @@ -581,8 +581,9 @@ static void free_printdict_t(printdict_t * dict) free(dict); } -#if defined(__SUNPRO_C) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__FreeBSD__) -/* for systems where ferror is a macro */ +#ifdef ferror +/* if ferror is a macro (__SUNPRO_C __CYGWIN__ __MINGW32__ __FreeBSD__ and poss others) + * then wrap it in a function */ static int agferror(FILE *stream) { return ferror(stream); @@ -599,8 +600,10 @@ int agwrite(Agraph_t * g, FILE * fp) AG.fwrite = fwrite; /* init to system version of fwrite() */ } if (AG.ferror == NULL) { -#if defined(__SUNPRO_C) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__FreeBSD__) +#ifdef ferror #undef ferror + /* if ferror is a macro, then use our wrapper function, but + * undef the macro first so it doesn't subst in "AG.ferror" */ AG.ferror = agferror; /* init to ferror macro wrapper function */ #else AG.ferror = ferror; /* init to system version of ferror() */