diff mcabber/src/hbuf.c @ 1227:79c396678f1b

Make buffer list display the number of allocated HBB blocks
author Mikael Berthe <mikael@lilotux.net>
date Sat, 19 May 2007 12:18:25 +0200
parents 2de8f8ba1f34
children 3a4018f18bdf
line wrap: on
line diff
--- a/mcabber/src/hbuf.c	Sat May 19 11:56:32 2007 +0200
+++ b/mcabber/src/hbuf.c	Sat May 19 12:18:25 2007 +0200
@@ -395,4 +395,21 @@
   return g_list_nth(hbuf, pc*hlen/100);
 }
 
+#ifdef DEBUG_ENABLE
+//  hbuf_get_blocks_number()
+// Returns the number of allocated hbuf_block's.
+guint hbuf_get_blocks_number(GList *hbuf)
+{
+  hbuf_block *hbuf_b_elt;
+  guint count = 0U;
+
+  for (hbuf = g_list_first(hbuf); hbuf; hbuf = g_list_next(hbuf)) {
+    hbuf_b_elt = (hbuf_block*)(hbuf->data);
+    if (hbuf_b_elt->flags & HBB_FLAG_ALLOC)
+      count++;
+  }
+  return count;
+}
+#endif
+
 /* vim: set expandtab cindent cinoptions=>2\:2(0:  For Vim users... */