From: erg Date: Wed, 4 Jan 2006 20:04:51 +0000 (+0000) Subject: Back out changes to remove warnings. The new code is illegal C and X-Git-Tag: LAST_LIBGRAPH~32^2~6891 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=59cd70ad57563fde52bc2f720b55bdbe2ae29dd2;p=graphviz Back out changes to remove warnings. The new code is illegal C and fails on sgis, suns and windows. Also, agxputc should mimic the semantics of putc, which returns an int. If warnings are a problem, we should use a compiler flag to turn off the warning or fix the uses. --- diff --git a/lib/graph/agxbuf.c b/lib/graph/agxbuf.c index bd1a7b0a4..d9bfa398c 100644 --- a/lib/graph/agxbuf.c +++ b/lib/graph/agxbuf.c @@ -44,7 +44,7 @@ void agxbinit(agxbuf * xb, unsigned int hint, unsigned char *init) /* agxbmore; * Expand buffer to hold at least ssz more bytes. */ -void agxbmore(agxbuf * xb, unsigned int ssz) +int agxbmore(agxbuf * xb, unsigned int ssz) { int cnt; /* current no. of characters in buffer */ int size; /* current buffer size */ @@ -66,6 +66,7 @@ void agxbmore(agxbuf * xb, unsigned int ssz) xb->buf = nbuf; xb->ptr = xb->buf + cnt; xb->eptr = xb->buf + nsize; + return 0; } /* agxbput_n: diff --git a/lib/graph/agxbuf.h b/lib/graph/agxbuf.h index 7a83115c2..767fe7c81 100644 --- a/lib/graph/agxbuf.h +++ b/lib/graph/agxbuf.h @@ -61,20 +61,15 @@ extern "C" { /* agxbmore: * Expand buffer to hold at least ssz more bytes. */ - extern void agxbmore(agxbuf * xb, int unsigned ssz); + extern int agxbmore(agxbuf * xb, int unsigned ssz); /* agxbputc: * Add character to buffer. * int agxbputc(agxbuf*, char) */ -#if 0 #define agxbputc(X,C) ((((X)->ptr >= (X)->eptr) ? agxbmore(X,1) : 0), \ (int)(*(X)->ptr++ = ((unsigned char)C))) -#else -/* this version avoids returning an unused int that causes compiler warnings */ -#define agxbputc(X,C) ({if ((X)->ptr >= (X)->eptr) agxbmore(X,1); \ - (int)(*(X)->ptr++ = ((unsigned char)C));}) -#endif + /* agxbuse: * Null-terminates buffer; resets and returns pointer to data; * char* agxbuse(agxbuf* xb)