MINOR: pools: make the pool allocator support a few flags

The pool_alloc_dirty() function was renamed to __pool_alloc() and now
takes a set of flags indicating whether poisonning is permitted or not
and whether zeroing the area is needed or not. The pool_alloc() function
is now just a wrapper calling __pool_alloc(pool, 0).
diff --git a/include/haproxy/dynbuf.h b/include/haproxy/dynbuf.h
index 2a90515..d337754 100644
--- a/include/haproxy/dynbuf.h
+++ b/include/haproxy/dynbuf.h
@@ -68,7 +68,7 @@
 		return buf;
 
 	*buf = BUF_WANTED;
-	area = pool_alloc_dirty(pool_head_buffer);
+	area = __pool_alloc(pool_head_buffer, POOL_F_NO_POISON);
 	if (unlikely(!area)) {
 		activity[tid].buf_wait++;
 		return NULL;
diff --git a/include/haproxy/pool-t.h b/include/haproxy/pool-t.h
index f1cba04..bc54c2d 100644
--- a/include/haproxy/pool-t.h
+++ b/include/haproxy/pool-t.h
@@ -81,6 +81,10 @@
 
 #define POOL_AVG_SAMPLES 1024
 
+/* possible flags for __pool_alloc() */
+#define POOL_F_NO_POISON    0x00000001  // do not poison the area
+#define POOL_F_MUST_ZERO    0x00000002  // zero the returned area
+
 
 struct pool_cache_head {
 	struct list list;    /* head of objects in this pool */
diff --git a/include/haproxy/pool.h b/include/haproxy/pool.h
index abaa087..b37fb9d 100644
--- a/include/haproxy/pool.h
+++ b/include/haproxy/pool.h
@@ -286,16 +286,16 @@
 /*
  * Returns a pointer to type <type> taken from the pool <pool_type> or
  * dynamically allocated. In the first case, <pool_type> is updated to point to
- * the next element in the list. No memory poisonning is ever performed on the
- * returned area.
+ * the next element in the list. <flags> is a binary-OR of POOL_F_* flags.
+ * Prefer using pool_alloc() which does the right thing without flags.
  */
-static inline void *pool_alloc_dirty(struct pool_head *pool)
+static inline void *__pool_alloc(struct pool_head *pool, unsigned int flags)
 {
 	void *p;
 
 #ifdef CONFIG_HAP_LOCAL_POOLS
 	if (likely(p = __pool_get_from_cache(pool)))
-		return p;
+		goto ret;
 #endif
 
 #if !defined(CONFIG_HAP_LOCKLESS_POOLS) && !defined(CONFIG_HAP_NO_GLOBAL_POOLS)
@@ -306,24 +306,23 @@
 #if !defined(CONFIG_HAP_LOCKLESS_POOLS) && !defined(CONFIG_HAP_NO_GLOBAL_POOLS)
 	HA_SPIN_UNLOCK(POOL_LOCK, &pool->lock);
 #endif
+ ret:
+	if (p) {
+		if (flags & POOL_F_MUST_ZERO)
+			memset(p, 0, pool->size);
+		else if (!(flags & POOL_F_NO_POISON) && mem_poison_byte >= 0)
+			memset(p, mem_poison_byte, pool->size);
+	}
 	return p;
 }
 
 /*
  * Returns a pointer to type <type> taken from the pool <pool_type> or
- * dynamically allocated. In the first case, <pool_type> is updated to point to
- * the next element in the list. Memory poisonning is performed if enabled.
+ * dynamically allocated. Memory poisonning is performed if enabled.
  */
 static inline void *pool_alloc(struct pool_head *pool)
 {
-	void *p;
-
-	p = pool_alloc_dirty(pool);
-	if (p && mem_poison_byte >= 0) {
-		memset(p, mem_poison_byte, pool->size);
-	}
-
-	return p;
+	return __pool_alloc(pool, 0);
 }
 
 /*