CLEANUP: quic: remove duplicated varint code from xprt_quic.h

There was some identical code between xprt_quic and quic_enc modules.
This concerns helper on QUIC varint type. Keep only the version in
quic_enc file : this should help to reduce dependency on xprt_quic
module.

Note that quic_max_int_by_size() has been removed and is replaced by the
identical quic_max_int().

This should be backported up to 2.6.
diff --git a/include/haproxy/quic_enc.h b/include/haproxy/quic_enc.h
index 1fddab7..45c2b4b 100644
--- a/include/haproxy/quic_enc.h
+++ b/include/haproxy/quic_enc.h
@@ -88,10 +88,10 @@
 	}
 }
 
-/* Returns the maximum integer which may be encoded with <size> bytes */
-static inline uint64_t quic_max_int_by_size(int size)
+/* Returns the maximum value of a QUIC variable-length integer with <sz> as size */
+static inline uint64_t quic_max_int(size_t sz)
 {
-	switch (size) {
+	switch (sz) {
 	case 1:
 		return QUIC_VARINT_1_BYTE_MAX;
 	case 2:
@@ -100,9 +100,9 @@
 		return QUIC_VARINT_4_BYTE_MAX;
 	case 8:
 		return QUIC_VARINT_8_BYTE_MAX;
-	default:
-		return 0;
 	}
+
+	return -1;
 }
 
 /* Decode a QUIC variable-length integer from <buf> buffer into <val>.
@@ -235,5 +235,36 @@
 	return 1;
 }
 
+static inline size_t quic_incint_size_diff(uint64_t val)
+{
+	switch (val) {
+	case QUIC_VARINT_1_BYTE_MAX:
+		return 1;
+	case QUIC_VARINT_2_BYTE_MAX:
+		return 2;
+	case QUIC_VARINT_4_BYTE_MAX:
+		return 4;
+	default:
+		return 0;
+	}
+}
+
+/* Return the difference between the encoded length of <val> and the encoded
+ * length of <val-1>.
+ */
+static inline size_t quic_decint_size_diff(uint64_t val)
+{
+	switch (val) {
+	case QUIC_VARINT_1_BYTE_MAX + 1:
+		return 1;
+	case QUIC_VARINT_2_BYTE_MAX + 1:
+		return 2;
+	case QUIC_VARINT_4_BYTE_MAX + 1:
+		return 4;
+	default:
+		return 0;
+	}
+}
+
 #endif /* USE_QUIC */
 #endif /* _HAPROXY_QUIC_ENC_H */
diff --git a/include/haproxy/xprt_quic.h b/include/haproxy/xprt_quic.h
index 5899238..b38490c 100644
--- a/include/haproxy/xprt_quic.h
+++ b/include/haproxy/xprt_quic.h
@@ -229,24 +229,6 @@
 	cid[0] = cid[0] - (cid[0] % global.nbthread) + target_tid;
 }
 
-/* The maximum size of a variable-length QUIC integer encoded with 1 byte */
-#define QUIC_VARINT_1_BYTE_MAX       ((1UL <<  6) - 1)
-/* The maximum size of a variable-length QUIC integer encoded with 2 bytes */
-#define QUIC_VARINT_2_BYTE_MAX       ((1UL <<  14) - 1)
-/* The maximum size of a variable-length QUIC integer encoded with 4 bytes */
-#define QUIC_VARINT_4_BYTE_MAX       ((1UL <<  30) - 1)
-/* The maximum size of a variable-length QUIC integer encoded with 8 bytes */
-#define QUIC_VARINT_8_BYTE_MAX       ((1ULL <<  62) - 1)
-
-/* The maximum size of a variable-length QUIC integer */
-#define QUIC_VARINT_MAX_SIZE       8
-
-/* The two most significant bits of byte #0 from a QUIC packet gives the 2 
- * logarithm of the length of a variable length encoded integer.
- */
-#define QUIC_VARINT_BYTE_0_BITMASK 0x3f
-#define QUIC_VARINT_BYTE_0_SHIFT   6
-
 /* Return a 32-bits integer in <val> from QUIC packet with <buf> as address.
  * Makes <buf> point to the data after this 32-bits value if succeeded.
  * Note that these 32-bits integers are network bytes ordered.
@@ -282,57 +264,6 @@
 	return 1;
 }
 
-/* Return the difference between the encoded length of <val> and the encoded
- * length of <val+1>.
- */
-static inline size_t quic_incint_size_diff(uint64_t val)
-{
-	switch (val) {
-	case QUIC_VARINT_1_BYTE_MAX:
-		return 1;
-	case QUIC_VARINT_2_BYTE_MAX:
-		return 2;
-	case QUIC_VARINT_4_BYTE_MAX:
-		return 4;
-	default:
-		return 0;
-	}
-}
-
-/* Return the difference between the encoded length of <val> and the encoded
- * length of <val-1>.
- */
-static inline size_t quic_decint_size_diff(uint64_t val)
-{
-	switch (val) {
-	case QUIC_VARINT_1_BYTE_MAX + 1:
-		return 1;
-	case QUIC_VARINT_2_BYTE_MAX + 1:
-		return 2;
-	case QUIC_VARINT_4_BYTE_MAX + 1:
-		return 4;
-	default:
-		return 0;
-	}
-}
-
-
-/* Returns the maximum value of a QUIC variable-length integer with <sz> as size */
-static inline uint64_t quic_max_int(size_t sz)
-{
-	switch (sz) {
-	case 1:
-		return QUIC_VARINT_1_BYTE_MAX;
-	case 2:
-		return QUIC_VARINT_2_BYTE_MAX;
-	case 4:
-		return QUIC_VARINT_4_BYTE_MAX;
-	case 8:
-		return QUIC_VARINT_8_BYTE_MAX;
-	}
-
-	return -1;
-}
 
 /* Return the maximum number of bytes we must use to completely fill a
  * buffer with <sz> as size for a data field of bytes prefixed by its QUIC
@@ -363,7 +294,7 @@
 		 *  +---------------------------+-----------....
 		 *  <--------------------------------> <sz>
 		 */
-		size_t max_int = quic_max_int_by_size(*len_sz);
+		size_t max_int = quic_max_int(*len_sz);
 
 		if (max_int + *len_sz <= sz)
 			ret = max_int;