MINOR: listener: now use a generic add_listener() function

With the removal of the family-specific port setting, all protocol had
exactly the same implementation of ->add(). A generic one was created
with the name "default_add_listener" so that all other ones can now be
removed. The API was slightly adjusted so that the protocol and the
listener are passed instead of the listener and the port.

Note that all protocols continue to provide this ->add() method instead
of routinely calling default_add_listener() from create_listeners(). This
makes sure that any non-standard protocol will still be able to intercept
the listener addition if needed.

This could be backported to 2.3 along with the few previous patches on
listners as a pure code cleanup.

(cherry picked from commit d1f250f87b8850f24456e62140509e612f8b3415)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/proto_sockpair.c b/src/proto_sockpair.c
index cc92753..fe74ff4 100644
--- a/src/proto_sockpair.c
+++ b/src/proto_sockpair.c
@@ -43,7 +43,6 @@
 #include <haproxy/version.h>
 
 
-static void sockpair_add_listener(struct listener *listener, int port);
 static int sockpair_bind_listener(struct listener *listener, char *errmsg, int errlen);
 static void sockpair_enable_listener(struct listener *listener);
 static void sockpair_disable_listener(struct listener *listener);
@@ -71,7 +70,7 @@
 	.sock_domain = AF_CUST_SOCKPAIR,
 	.sock_type = SOCK_STREAM,
 	.sock_prot = 0,
-	.add = sockpair_add_listener,
+	.add = default_add_listener,
 	.listen = sockpair_bind_listener,
 	.enable = sockpair_enable_listener,
 	.disable = sockpair_disable_listener,
@@ -89,23 +88,6 @@
 
 INITCALL1(STG_REGISTER, protocol_register, &proto_sockpair);
 
-/* Add <listener> to the list of sockpair listeners (port is ignored). The
- * listener's state is automatically updated from LI_INIT to LI_ASSIGNED.
- * The number of listeners for the protocol is updated.
- *
- * Must be called with proto_lock held.
- *
- */
-static void sockpair_add_listener(struct listener *listener, int port)
-{
-	if (listener->state != LI_INIT)
-		return;
-	listener_set_state(listener, LI_ASSIGNED);
-	listener->rx.proto = &proto_sockpair;
-	LIST_ADDQ(&proto_sockpair.receivers, &listener->rx.proto_list);
-	proto_sockpair.nb_receivers++;
-}
-
 /* Enable receipt of incoming connections for listener <l>. The receiver must
  * still be valid.
  */