DEBUG: opentracing: show return values of all functions in the debug output

If the OpenTracing filter is compiled using the 'OT_DEBUG=1' option, then
log messages are printed to stderr when the filter is running.  In the log
one can then find (among other things) the order in which the function is
called and the value that the function returns (if it is not a void type).

Prior to applying this patch, no value returned by a function was logged.

Log output example:
  [ 1]    0.038807 [OT]: flt_ot_init_per_thread(0x56365bd45ec0, 0x56365bd48210) {
  [ 1]    0.038807 [OT]:    ot_start(0x56365bd58920, 0x56365bd4e3a0, 0x7f561acba168:(nil)) {
  [ 1]    0.038807 [OT]:    } = 0
  [ 1]    0.038807 [OT]: } = 0

This patch must be backported as far as 2.4.

(cherry picked from commit ca09e01a137ebb557fbda3edb79dd22922753667)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 83eb076c3be8ef2eaa61c3b33f219d1decb575cb)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/addons/ot/src/scope.c b/addons/ot/src/scope.c
index 8d70a08..ec5e81f 100644
--- a/addons/ot/src/scope.c
+++ b/addons/ot/src/scope.c
@@ -101,7 +101,7 @@
 
 	retptr = flt_ot_pool_alloc(pool_head_ot_runtime_context, sizeof(*retptr), 1, err);
 	if (retptr == NULL)
-		FLT_OT_RETURN(retptr);
+		FLT_OT_RETURN_PTR(retptr);
 
 	retptr->stream        = s;
 	retptr->filter        = f;
@@ -125,7 +125,7 @@
 
 	FLT_OT_DBG_RUNTIME_CONTEXT("session context: ", retptr);
 
-	FLT_OT_RETURN(retptr);
+	FLT_OT_RETURN_PTR(retptr);
 }
 
 
@@ -209,13 +209,13 @@
 	FLT_OT_FUNC("%p, \"%s\", %zu, %d, \"%s\", %zu, %u, %p:%p", rt_ctx, id, id_len, ref_type, ref_id, ref_id_len, dir, FLT_OT_DPTR_ARGS(err));
 
 	if ((rt_ctx == NULL) || (id == NULL))
-		FLT_OT_RETURN(retptr);
+		FLT_OT_RETURN_PTR(retptr);
 
 	list_for_each_entry(span, &(rt_ctx->spans), list)
 		if ((span->id_len == id_len) && (memcmp(span->id, id, id_len) == 0)) {
 			FLT_OT_DBG(2, "found span %p", span);
 
-			FLT_OT_RETURN(span);
+			FLT_OT_RETURN_PTR(span);
 		}
 
 	if (ref_id != NULL) {
@@ -241,14 +241,14 @@
 			} else {
 				FLT_OT_ERR("cannot find referenced span/context '%s'", ref_id);
 
-				FLT_OT_RETURN(retptr);
+				FLT_OT_RETURN_PTR(retptr);
 			}
 		}
 	}
 
 	retptr = flt_ot_pool_alloc(pool_head_ot_scope_span, sizeof(*retptr), 1, err);
 	if (retptr == NULL)
-		FLT_OT_RETURN(retptr);
+		FLT_OT_RETURN_PTR(retptr);
 
 	retptr->id          = id;
 	retptr->id_len      = id_len;
@@ -260,7 +260,7 @@
 
 	FLT_OT_DBG_SCOPE_SPAN("new span ", retptr);
 
-	FLT_OT_RETURN(retptr);
+	FLT_OT_RETURN_PTR(retptr);
 }
 
 
@@ -328,24 +328,24 @@
 	FLT_OT_FUNC("%p, %p, \"%s\", %zu, %p, %u, %p:%p", rt_ctx, tracer, id, id_len, text_map, dir, FLT_OT_DPTR_ARGS(err));
 
 	if ((rt_ctx == NULL) || (tracer == NULL) || (id == NULL) || (text_map == NULL))
-		FLT_OT_RETURN(retptr);
+		FLT_OT_RETURN_PTR(retptr);
 
 	list_for_each_entry(retptr, &(rt_ctx->contexts), list)
 		if ((retptr->id_len == id_len) && (memcmp(retptr->id, id, id_len) == 0)) {
 			FLT_OT_DBG(2, "found context %p", retptr);
 
-			FLT_OT_RETURN(retptr);
+			FLT_OT_RETURN_PTR(retptr);
 		}
 
 	retptr = flt_ot_pool_alloc(pool_head_ot_scope_context, sizeof(*retptr), 1, err);
 	if (retptr == NULL)
-		FLT_OT_RETURN(retptr);
+		FLT_OT_RETURN_PTR(retptr);
 
 	span_ctx = ot_extract_http_headers(tracer, &reader, text_map, err);
 	if (span_ctx == NULL) {
 		flt_ot_scope_context_free(&retptr);
 
-		FLT_OT_RETURN(retptr);
+		FLT_OT_RETURN_PTR(retptr);
 	}
 
 	retptr->id          = id;
@@ -356,7 +356,7 @@
 
 	FLT_OT_DBG_SCOPE_CONTEXT("new context ", retptr);
 
-	FLT_OT_RETURN(retptr);
+	FLT_OT_RETURN_PTR(retptr);
 }
 
 
@@ -523,7 +523,7 @@
 
 	retval = span_cnt + ctx_cnt;
 
-	FLT_OT_RETURN(retval);
+	FLT_OT_RETURN_INT(retval);
 }