]> mj.ucw.cz Git - libucw.git/commitdiff
Added optional debug messages on buffer growing.
authorMartin Mares <mj@ucw.cz>
Mon, 29 Aug 2005 16:21:19 +0000 (16:21 +0000)
committerMartin Mares <mj@ucw.cz>
Mon, 29 Aug 2005 16:21:19 +0000 (16:21 +0000)
lib/gbuf.h

index 0775f20cb3738bb976176a72af94918322261f9d..d202adb6f1b05e5e2f03fef90cf847d0f67b10a5 100644 (file)
@@ -2,6 +2,7 @@
  *     UCW Library -- A simple growing buffer
  *
  *     (c) 2004, Robert Spalek <robert@ucw.cz>
+ *     (c) 2005, Martin Mares <mj@ucw.cz>
  *
  *     Define the following macros:
  *
@@ -44,6 +45,9 @@ GBUF_PREFIX(realloc)(BUF_T *b, uns len)
 {
   b->len = len;
   b->ptr = xrealloc(b->ptr, len * sizeof(GBUF_TYPE));
+#ifdef GBUF_TRACE
+  log(L_DEBUG, STRINGIFY_EXPANDED(BUF_T) " growing to %u items", len);
+#endif
 }
 
 static inline void
@@ -58,4 +62,5 @@ GBUF_PREFIX(grow)(BUF_T *b, uns len)
 
 #undef GBUF_TYPE
 #undef GBUF_PREFIX
+#undef  GBUF_TRACE
 #undef BUF_T