MAJOR: buffer: finalize buffer detachment

Now the buffers only contain the header and a pointer to the storage
area which can be anywhere. This will significantly simplify buffer
swapping and will make it possible to map chunks on buffers as well.

The buf_empty variable was removed, as now it's enough to have size==0
and area==NULL to designate the empty buffer (thus a non-allocated head
is the empty buffer by default). buf_wanted for now is indicated by
size==0 and area==(void *)1.

The channels and the checks now embed the buffer's head, and the only
pointer is to the storage area. This slightly increases the unallocated
buffer size (3 extra ints for the empty buffer) but considerably
simplifies dynamic buffer management. It will also later permit to
detach unused checks.

The way the struct buffer is arranged has proven quite efficient on a
number of tests, which makes sense given that size is always accessed
and often first, followed by the othe ones.
diff --git a/include/common/buf.h b/include/common/buf.h
index bd58a4d..92db0a1 100644
--- a/include/common/buf.h
+++ b/include/common/buf.h
@@ -32,12 +32,25 @@
 
 /* Structure defining a buffer's head */
 struct buffer {
-	size_t head;                /* start offset of remaining data relative to area */
-	size_t data;                /* amount of data after head including wrapping */
 	size_t size;                /* buffer size in bytes */
-	char   area[0];             /* <size> bytes of stored data */
+	char  *area;                /* points to <size> bytes */
+	size_t data;                /* amount of data after head including wrapping */
+	size_t head;                /* start offset of remaining data relative to area */
 };
 
+/* A buffer may be in 3 different states :
+ *   - unallocated : size == 0, area == 0  (b_is_null() is true)
+ *   - waiting     : size == 0, area != 0
+ *   - allocated   : size  > 0, area  > 0
+ */
+
+/* initializers for certain buffer states. It is important that the NULL buffer
+ * remains the one with all fields initialized to zero so that a calloc() or a
+ * memset() on a struct automatically sets a NULL buffer.
+ */
+#define BUF_NULL   ((struct buffer){ })
+#define BUF_WANTED ((struct buffer){ .area = (char *)1 })
+
 
 /***************************************************************************/
 /* Functions used to compute offsets and pointers. Most of them exist in   */
@@ -46,13 +59,21 @@
 /* offset relative to the storage area.                                    */
 /***************************************************************************/
 
+/* b_is_null() : returns true if (and only if) the buffer is not yet allocated
+ * and thus points to a NULL area.
+ */
+static inline int b_is_null(const struct buffer *buf)
+{
+	return buf->area == NULL;
+}
+
 /* b_orig() : returns the pointer to the origin of the storage, which is the
  * location of byte at offset zero. This is mostly used by functions which
  * handle the wrapping by themselves.
  */
 static inline char *b_orig(const struct buffer *b)
 {
-	return (char *)b->area;
+	return b->area;
 }
 
 /* b_size() : returns the size of the buffer. */
@@ -66,7 +87,7 @@
  */
 static inline char *b_wrap(const struct buffer *b)
 {
-	return (char *)b->area + b->size;
+	return b->area + b->size;
 }
 
 /* b_data() : returns the number of bytes present in the buffer. */