]> granicus.if.org Git - graphviz/commitdiff
Back out changes to remove warnings. The new code is illegal C and
authorerg <devnull@localhost>
Wed, 4 Jan 2006 20:04:51 +0000 (20:04 +0000)
committererg <devnull@localhost>
Wed, 4 Jan 2006 20:04:51 +0000 (20:04 +0000)
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.

lib/graph/agxbuf.c
lib/graph/agxbuf.h

index bd1a7b0a4c2552ca66e9119fea8585c2f1f505ce..d9bfa398c63177fe6a45475735d318b8f1bcc345 100644 (file)
@@ -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:
index 7a83115c254b0603a8962ae28f011297c36074be..767fe7c81fa7370f64889459bf08dc24ebd10648 100644 (file)
@@ -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)