]> granicus.if.org Git - graphviz/commitdiff
recode agxbputc macro to avoid unused int result
authorellson <devnull@localhost>
Fri, 30 Dec 2005 14:10:31 +0000 (14:10 +0000)
committerellson <devnull@localhost>
Fri, 30 Dec 2005 14:10:31 +0000 (14:10 +0000)
lib/graph/agxbuf.h

index 1f1cfa333366d47528b0d4c01089edb0ad40cdbb..7a83115c254b0603a8962ae28f011297c36074be 100644 (file)
@@ -67,9 +67,14 @@ extern "C" {
  * 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)