Commit 9ea25b50585 for php

commit 9ea25b50585269f92ba192585f57d1a865845fc3
Author: Tim Düsterhus <tim@tideways-gmbh.com>
Date:   Tue Nov 3 08:39:01 2026 +0100

    uri: Update to uriparser-1.0.3 (#25145)

    This fixes CVE-2026-48841.

diff --git a/NEWS b/NEWS
index 3cf3cf52b81..5de475a2252 100644
--- a/NEWS
+++ b/NEWS
@@ -334,6 +334,7 @@ PHP                                                                        NEWS
 - URI:
   . Fixed bug GH-25019 (Uri\Rfc3986\Uri rejects a port with leading zeros as
     out of range). (lazerg)
+  . Upgrade to uriparser 1.0.3. (CVE-2026-48841) (Sebastian Pipping, timwolla)

 - Windows:
   . Fixed bug GH-25009 (GetConsoleTitleW() buffer size passed in bytes).
diff --git a/ext/uri/uriparser/include/uriparser/Uri.h b/ext/uri/uriparser/include/uriparser/Uri.h
index ddbbd26f9e4..e05ebfb2384 100644
--- a/ext/uri/uriparser/include/uriparser/Uri.h
+++ b/ext/uri/uriparser/include/uriparser/Uri.h
@@ -1,4 +1,4 @@
-/* c9d94656d067288e474df19a062d487c736b0fa8517d2ef7bbeb8dcd5a70c05b (1.0.2+)
+/* 9e66e003d384ea11f187e27b8a6a09e9f917467321dc6698b876d7500e62d2e7 (1.0.3+)
  *
  * uriparser - RFC 3986 URI parsing library
  *
@@ -45,8 +45,8 @@
  */

 #if (defined(URI_PASS_ANSI) && !defined(URI_H_ANSI)) \
-    || (defined(URI_PASS_UNICODE) && !defined(URI_H_UNICODE)) \
-    || (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
+        || (defined(URI_PASS_UNICODE) && !defined(URI_H_UNICODE)) \
+        || (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
 /* What encodings are enabled? */
 #  include "UriDefsConfig.h"
 #  if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
@@ -63,8 +63,8 @@
 #    endif
 /* Only one pass for each encoding */
 #  elif (defined(URI_PASS_ANSI) && !defined(URI_H_ANSI) && defined(URI_ENABLE_ANSI)) \
-      || (defined(URI_PASS_UNICODE) && !defined(URI_H_UNICODE) \
-          && defined(URI_ENABLE_UNICODE))
+          || (defined(URI_PASS_UNICODE) && !defined(URI_H_UNICODE) \
+                  && defined(URI_ENABLE_UNICODE))
 #    ifdef URI_PASS_ANSI
 #      define URI_H_ANSI 1
 #      include "UriDefsAnsi.h"
@@ -218,8 +218,8 @@ URI_PUBLIC UriBool URI_FUNC(HasHost)(const URI_TYPE(Uri) * uri);
  * @see uriIsWellFormedHostIp6A
  * @since 0.9.9
  */
-URI_PUBLIC int URI_FUNC(ParseIpSixAddress)(UriIp6 * output, const URI_CHAR * first,
-                                           const URI_CHAR * afterLast);
+URI_PUBLIC int URI_FUNC(ParseIpSixAddress)(
+        UriIp6 * output, const URI_CHAR * first, const URI_CHAR * afterLast);

 /**
  * Converts an IPv6 text representation into 16 bytes.
@@ -236,8 +236,7 @@ URI_PUBLIC int URI_FUNC(ParseIpSixAddress)(UriIp6 * output, const URI_CHAR * fir
  * @since 0.9.9
  */
 URI_PUBLIC int URI_FUNC(ParseIpSixAddressMm)(UriIp6 * output, const URI_CHAR * first,
-                                             const URI_CHAR * afterLast,
-                                             UriMemoryManager * memory);
+        const URI_CHAR * afterLast, UriMemoryManager * memory);

 /**
  * Parses a RFC 3986 %URI.
@@ -258,7 +257,7 @@ URI_PUBLIC int URI_FUNC(ParseIpSixAddressMm)(UriIp6 * output, const URI_CHAR * f
  * "Single").
  */
 URI_PUBLIC int URI_FUNC(ParseUriEx)(URI_TYPE(ParserState) * state, const URI_CHAR * first,
-                                    const URI_CHAR * afterLast);
+        const URI_CHAR * afterLast);

 /**
  * Parses a RFC 3986 %URI.
@@ -295,8 +294,8 @@ URI_PUBLIC int URI_FUNC(ParseUri)(URI_TYPE(ParserState) * state, const URI_CHAR
  * @see uriToStringA
  * @since 0.9.0
  */
-URI_PUBLIC int URI_FUNC(ParseSingleUri)(URI_TYPE(Uri) * uri, const URI_CHAR * text,
-                                        const URI_CHAR ** errorPos);
+URI_PUBLIC int URI_FUNC(ParseSingleUri)(
+        URI_TYPE(Uri) * uri, const URI_CHAR * text, const URI_CHAR ** errorPos);

 /**
  * Parses a single RFC 3986 %URI.
@@ -319,8 +318,7 @@ URI_PUBLIC int URI_FUNC(ParseSingleUri)(URI_TYPE(Uri) * uri, const URI_CHAR * te
  * @since 0.9.0
  */
 URI_PUBLIC int URI_FUNC(ParseSingleUriEx)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                                          const URI_CHAR * afterLast,
-                                          const URI_CHAR ** errorPos);
+        const URI_CHAR * afterLast, const URI_CHAR ** errorPos);

 /**
  * Parses a single RFC 3986 %URI.
@@ -343,9 +341,8 @@ URI_PUBLIC int URI_FUNC(ParseSingleUriEx)(URI_TYPE(Uri) * uri, const URI_CHAR *
  * @since 0.9.0
  */
 URI_PUBLIC int URI_FUNC(ParseSingleUriExMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                                            const URI_CHAR * afterLast,
-                                            const URI_CHAR ** errorPos,
-                                            UriMemoryManager * memory);
+        const URI_CHAR * afterLast, const URI_CHAR ** errorPos,
+        UriMemoryManager * memory);

 /**
  * Frees all memory associated with the members
@@ -411,8 +408,8 @@ URI_PUBLIC int URI_FUNC(FreeUriMembersMm)(URI_TYPE(Uri) * uri, UriMemoryManager
  * @since 0.5.2
  */
 URI_PUBLIC URI_CHAR * URI_FUNC(EscapeEx)(const URI_CHAR * inFirst,
-                                         const URI_CHAR * inAfterLast, URI_CHAR * out,
-                                         UriBool spaceToPlus, UriBool normalizeBreaks);
+        const URI_CHAR * inAfterLast, URI_CHAR * out, UriBool spaceToPlus,
+        UriBool normalizeBreaks);

 /**
  * Percent-encodes all but unreserved characters from the input string and
@@ -442,7 +439,7 @@ URI_PUBLIC URI_CHAR * URI_FUNC(EscapeEx)(const URI_CHAR * inFirst,
  * @since 0.5.0
  */
 URI_PUBLIC URI_CHAR * URI_FUNC(Escape)(const URI_CHAR * in, URI_CHAR * out,
-                                       UriBool spaceToPlus, UriBool normalizeBreaks);
+        UriBool spaceToPlus, UriBool normalizeBreaks);

 /**
  * Unescapes percent-encoded groups in a given string.
@@ -461,9 +458,8 @@ URI_PUBLIC URI_CHAR * URI_FUNC(Escape)(const URI_CHAR * in, URI_CHAR * out,
  * @see uriEscapeExA
  * @since 0.5.0
  */
-URI_PUBLIC const URI_CHAR *
-    URI_FUNC(UnescapeInPlaceEx)(URI_CHAR * inout, UriBool plusToSpace,
-                                UriBreakConversion breakConversion);
+URI_PUBLIC const URI_CHAR * URI_FUNC(UnescapeInPlaceEx)(
+        URI_CHAR * inout, UriBool plusToSpace, UriBreakConversion breakConversion);

 /**
  * Unescapes percent-encoded groups in a given string.
@@ -503,8 +499,7 @@ URI_PUBLIC const URI_CHAR * URI_FUNC(UnescapeInPlace)(URI_CHAR * inout);
  * @since 0.4.0
  */
 URI_PUBLIC int URI_FUNC(AddBaseUri)(URI_TYPE(Uri) * absoluteDest,
-                                    const URI_TYPE(Uri) * relativeSource,
-                                    const URI_TYPE(Uri) * absoluteBase);
+        const URI_TYPE(Uri) * relativeSource, const URI_TYPE(Uri) * absoluteBase);

 /**
  * Performs reference resolution as described in
@@ -524,9 +519,8 @@ URI_PUBLIC int URI_FUNC(AddBaseUri)(URI_TYPE(Uri) * absoluteDest,
  * @since 0.8.1
  */
 URI_PUBLIC int URI_FUNC(AddBaseUriEx)(URI_TYPE(Uri) * absoluteDest,
-                                      const URI_TYPE(Uri) * relativeSource,
-                                      const URI_TYPE(Uri) * absoluteBase,
-                                      UriResolutionOptions options);
+        const URI_TYPE(Uri) * relativeSource, const URI_TYPE(Uri) * absoluteBase,
+        UriResolutionOptions options);

 /**
  * Performs reference resolution as described in
@@ -548,10 +542,8 @@ URI_PUBLIC int URI_FUNC(AddBaseUriEx)(URI_TYPE(Uri) * absoluteDest,
  * @since 0.9.0
  */
 URI_PUBLIC int URI_FUNC(AddBaseUriExMm)(URI_TYPE(Uri) * absoluteDest,
-                                        const URI_TYPE(Uri) * relativeSource,
-                                        const URI_TYPE(Uri) * absoluteBase,
-                                        UriResolutionOptions options,
-                                        UriMemoryManager * memory);
+        const URI_TYPE(Uri) * relativeSource, const URI_TYPE(Uri) * absoluteBase,
+        UriResolutionOptions options, UriMemoryManager * memory);

 /**
  * Tries to make a relative %URI (a reference) from an
@@ -576,9 +568,8 @@ URI_PUBLIC int URI_FUNC(AddBaseUriExMm)(URI_TYPE(Uri) * absoluteDest,
  * @since 0.5.2
  */
 URI_PUBLIC int URI_FUNC(RemoveBaseUri)(URI_TYPE(Uri) * dest,
-                                       const URI_TYPE(Uri) * absoluteSource,
-                                       const URI_TYPE(Uri) * absoluteBase,
-                                       UriBool domainRootMode);
+        const URI_TYPE(Uri) * absoluteSource, const URI_TYPE(Uri) * absoluteBase,
+        UriBool domainRootMode);

 /**
  * Tries to make a relative %URI (a reference) from an
@@ -603,10 +594,8 @@ URI_PUBLIC int URI_FUNC(RemoveBaseUri)(URI_TYPE(Uri) * dest,
  * @since 0.9.0
  */
 URI_PUBLIC int URI_FUNC(RemoveBaseUriMm)(URI_TYPE(Uri) * dest,
-                                         const URI_TYPE(Uri) * absoluteSource,
-                                         const URI_TYPE(Uri) * absoluteBase,
-                                         UriBool domainRootMode,
-                                         UriMemoryManager * memory);
+        const URI_TYPE(Uri) * absoluteSource, const URI_TYPE(Uri) * absoluteBase,
+        UriBool domainRootMode, UriMemoryManager * memory);

 /**
  * Checks two URIs for equivalence. Comparison is done
@@ -634,8 +623,8 @@ URI_PUBLIC UriBool URI_FUNC(EqualsUri)(const URI_TYPE(Uri) * a, const URI_TYPE(U
  * @see uriToStringA
  * @since 0.5.0
  */
-URI_PUBLIC int URI_FUNC(ToStringCharsRequired)(const URI_TYPE(Uri) * uri,
-                                               int * charsRequired);
+URI_PUBLIC int URI_FUNC(ToStringCharsRequired)(
+        const URI_TYPE(Uri) * uri, int * charsRequired);

 /**
  * Converts a %URI structure back to text as described in
@@ -658,8 +647,8 @@ URI_PUBLIC int URI_FUNC(ToStringCharsRequired)(const URI_TYPE(Uri) * uri,
  * @see uriToStringCharsRequiredA
  * @since 0.4.0
  */
-URI_PUBLIC int URI_FUNC(ToString)(URI_CHAR * dest, const URI_TYPE(Uri) * uri,
-                                  int maxChars, int * charsWritten);
+URI_PUBLIC int URI_FUNC(ToString)(
+        URI_CHAR * dest, const URI_TYPE(Uri) * uri, int maxChars, int * charsWritten);

 /**
  * Copies a %URI structure.
@@ -673,8 +662,7 @@ URI_PUBLIC int URI_FUNC(ToString)(URI_CHAR * dest, const URI_TYPE(Uri) * uri,
  * @since 0.9.9
  */
 URI_PUBLIC int URI_FUNC(CopyUriMm)(URI_TYPE(Uri) * destUri,
-                                   const URI_TYPE(Uri) * sourceUri,
-                                   UriMemoryManager * memory);
+        const URI_TYPE(Uri) * sourceUri, UriMemoryManager * memory);

 /**
  * Copies a %URI structure.
@@ -686,8 +674,8 @@ URI_PUBLIC int URI_FUNC(CopyUriMm)(URI_TYPE(Uri) * destUri,
  * @see uriCopyUriMmA
  * @since 0.9.9
  */
-URI_PUBLIC int URI_FUNC(CopyUri)(URI_TYPE(Uri) * destUri,
-                                 const URI_TYPE(Uri) * sourceUri);
+URI_PUBLIC int URI_FUNC(CopyUri)(
+        URI_TYPE(Uri) * destUri, const URI_TYPE(Uri) * sourceUri);

 /**
  * Determines the components of a %URI that are not normalized.
@@ -718,8 +706,8 @@ URI_PUBLIC unsigned int URI_FUNC(NormalizeSyntaxMaskRequired)(const URI_TYPE(Uri
  * @see uriNormalizeSyntaxMaskRequiredA
  * @since 0.9.0
  */
-URI_PUBLIC int URI_FUNC(NormalizeSyntaxMaskRequiredEx)(const URI_TYPE(Uri) * uri,
-                                                       unsigned int * outMask);
+URI_PUBLIC int URI_FUNC(NormalizeSyntaxMaskRequiredEx)(
+        const URI_TYPE(Uri) * uri, unsigned int * outMask);

 /**
  * Normalizes a %URI using a normalization mask.
@@ -757,8 +745,8 @@ URI_PUBLIC int URI_FUNC(NormalizeSyntaxEx)(URI_TYPE(Uri) * uri, unsigned int mas
  * @see uriNormalizeSyntaxMaskRequiredA
  * @since 0.9.0
  */
-URI_PUBLIC int URI_FUNC(NormalizeSyntaxExMm)(URI_TYPE(Uri) * uri, unsigned int mask,
-                                             UriMemoryManager * memory);
+URI_PUBLIC int URI_FUNC(NormalizeSyntaxExMm)(
+        URI_TYPE(Uri) * uri, unsigned int mask, UriMemoryManager * memory);

 /**
  * Normalizes all components of a %URI.
@@ -795,8 +783,8 @@ URI_PUBLIC int URI_FUNC(NormalizeSyntax)(URI_TYPE(Uri) * uri);
  * @see uriWindowsFilenameToUriStringA
  * @since 0.5.2
  */
-URI_PUBLIC int URI_FUNC(UnixFilenameToUriString)(const URI_CHAR * filename,
-                                                 URI_CHAR * uriString);
+URI_PUBLIC int URI_FUNC(UnixFilenameToUriString)(
+        const URI_CHAR * filename, URI_CHAR * uriString);

 /**
  * Converts a Windows filename to a %URI string.
@@ -816,8 +804,8 @@ URI_PUBLIC int URI_FUNC(UnixFilenameToUriString)(const URI_CHAR * filename,
  * @see uriUnixFilenameToUriStringA
  * @since 0.5.2
  */
-URI_PUBLIC int URI_FUNC(WindowsFilenameToUriString)(const URI_CHAR * filename,
-                                                    URI_CHAR * uriString);
+URI_PUBLIC int URI_FUNC(WindowsFilenameToUriString)(
+        const URI_CHAR * filename, URI_CHAR * uriString);

 /**
  * Extracts a Unix filename from a %URI string.
@@ -833,8 +821,8 @@ URI_PUBLIC int URI_FUNC(WindowsFilenameToUriString)(const URI_CHAR * filename,
  * @see uriUriStringToWindowsFilenameA
  * @since 0.5.2
  */
-URI_PUBLIC int URI_FUNC(UriStringToUnixFilename)(const URI_CHAR * uriString,
-                                                 URI_CHAR * filename);
+URI_PUBLIC int URI_FUNC(UriStringToUnixFilename)(
+        const URI_CHAR * uriString, URI_CHAR * filename);

 /**
  * Extracts a Windows filename from a %URI string.
@@ -850,8 +838,8 @@ URI_PUBLIC int URI_FUNC(UriStringToUnixFilename)(const URI_CHAR * uriString,
  * @see uriUriStringToUnixFilenameA
  * @since 0.5.2
  */
-URI_PUBLIC int URI_FUNC(UriStringToWindowsFilename)(const URI_CHAR * uriString,
-                                                    URI_CHAR * filename);
+URI_PUBLIC int URI_FUNC(UriStringToWindowsFilename)(
+        const URI_CHAR * uriString, URI_CHAR * filename);

 /**
  * Calculates the number of characters needed to store the
@@ -868,8 +856,8 @@ URI_PUBLIC int URI_FUNC(UriStringToWindowsFilename)(const URI_CHAR * uriString,
  * @see uriComposeQueryA
  * @since 0.7.0
  */
-URI_PUBLIC int URI_FUNC(ComposeQueryCharsRequired)(const URI_TYPE(QueryList) * queryList,
-                                                   int * charsRequired);
+URI_PUBLIC int URI_FUNC(ComposeQueryCharsRequired)(
+        const URI_TYPE(QueryList) * queryList, int * charsRequired);

 /**
  * Calculates the number of characters needed to store the
@@ -887,10 +875,9 @@ URI_PUBLIC int URI_FUNC(ComposeQueryCharsRequired)(const URI_TYPE(QueryList) * q
  * @see uriComposeQueryExA
  * @since 0.7.0
  */
-URI_PUBLIC int
-    URI_FUNC(ComposeQueryCharsRequiredEx)(const URI_TYPE(QueryList) * queryList,
-                                          int * charsRequired, UriBool spaceToPlus,
-                                          UriBool normalizeBreaks);
+URI_PUBLIC int URI_FUNC(ComposeQueryCharsRequiredEx)(
+        const URI_TYPE(QueryList) * queryList, int * charsRequired, UriBool spaceToPlus,
+        UriBool normalizeBreaks);

 /**
  * Converts a query list structure back to a query string.
@@ -917,8 +904,7 @@ URI_PUBLIC int
  * @since 0.7.0
  */
 URI_PUBLIC int URI_FUNC(ComposeQuery)(URI_CHAR * dest,
-                                      const URI_TYPE(QueryList) * queryList, int maxChars,
-                                      int * charsWritten);
+        const URI_TYPE(QueryList) * queryList, int maxChars, int * charsWritten);

 /**
  * Converts a query list structure back to a query string.
@@ -945,9 +931,8 @@ URI_PUBLIC int URI_FUNC(ComposeQuery)(URI_CHAR * dest,
  * @since 0.7.0
  */
 URI_PUBLIC int URI_FUNC(ComposeQueryEx)(URI_CHAR * dest,
-                                        const URI_TYPE(QueryList) * queryList,
-                                        int maxChars, int * charsWritten,
-                                        UriBool spaceToPlus, UriBool normalizeBreaks);
+        const URI_TYPE(QueryList) * queryList, int maxChars, int * charsWritten,
+        UriBool spaceToPlus, UriBool normalizeBreaks);

 /**
  * Converts a query list structure back to a query string.
@@ -969,8 +954,8 @@ URI_PUBLIC int URI_FUNC(ComposeQueryEx)(URI_CHAR * dest,
  * @see uriDissectQueryMallocExMmA
  * @since 0.7.0
  */
-URI_PUBLIC int URI_FUNC(ComposeQueryMalloc)(URI_CHAR ** dest,
-                                            const URI_TYPE(QueryList) * queryList);
+URI_PUBLIC int URI_FUNC(ComposeQueryMalloc)(
+        URI_CHAR ** dest, const URI_TYPE(QueryList) * queryList);

 /**
  * Converts a query list structure back to a query string.
@@ -993,9 +978,8 @@ URI_PUBLIC int URI_FUNC(ComposeQueryMalloc)(URI_CHAR ** dest,
  * @since 0.7.0
  */
 URI_PUBLIC int URI_FUNC(ComposeQueryMallocEx)(URI_CHAR ** dest,
-                                              const URI_TYPE(QueryList) * queryList,
-                                              UriBool spaceToPlus,
-                                              UriBool normalizeBreaks);
+        const URI_TYPE(QueryList) * queryList, UriBool spaceToPlus,
+        UriBool normalizeBreaks);

 /**
  * Converts a query list structure back to a query string.
@@ -1018,10 +1002,8 @@ URI_PUBLIC int URI_FUNC(ComposeQueryMallocEx)(URI_CHAR ** dest,
  * @since 0.9.0
  */
 URI_PUBLIC int URI_FUNC(ComposeQueryMallocExMm)(URI_CHAR ** dest,
-                                                const URI_TYPE(QueryList) * queryList,
-                                                UriBool spaceToPlus,
-                                                UriBool normalizeBreaks,
-                                                UriMemoryManager * memory);
+        const URI_TYPE(QueryList) * queryList, UriBool spaceToPlus,
+        UriBool normalizeBreaks, UriMemoryManager * memory);

 /**
  * Constructs a query list from the raw query string of a given URI.
@@ -1042,8 +1024,7 @@ URI_PUBLIC int URI_FUNC(ComposeQueryMallocExMm)(URI_CHAR ** dest,
  * @since 0.7.0
  */
 URI_PUBLIC int URI_FUNC(DissectQueryMalloc)(URI_TYPE(QueryList) * *dest, int * itemCount,
-                                            const URI_CHAR * first,
-                                            const URI_CHAR * afterLast);
+        const URI_CHAR * first, const URI_CHAR * afterLast);

 /**
  * Constructs a query list from the raw query string of a given URI.
@@ -1064,10 +1045,8 @@ URI_PUBLIC int URI_FUNC(DissectQueryMalloc)(URI_TYPE(QueryList) * *dest, int * i
  * @since 0.7.0
  */
 URI_PUBLIC int URI_FUNC(DissectQueryMallocEx)(URI_TYPE(QueryList) * *dest,
-                                              int * itemCount, const URI_CHAR * first,
-                                              const URI_CHAR * afterLast,
-                                              UriBool plusToSpace,
-                                              UriBreakConversion breakConversion);
+        int * itemCount, const URI_CHAR * first, const URI_CHAR * afterLast,
+        UriBool plusToSpace, UriBreakConversion breakConversion);

 /**
  * Constructs a query list from the raw query string of a given URI.
@@ -1089,11 +1068,9 @@ URI_PUBLIC int URI_FUNC(DissectQueryMallocEx)(URI_TYPE(QueryList) * *dest,
  * @since 0.9.0
  */
 URI_PUBLIC int URI_FUNC(DissectQueryMallocExMm)(URI_TYPE(QueryList) * *dest,
-                                                int * itemCount, const URI_CHAR * first,
-                                                const URI_CHAR * afterLast,
-                                                UriBool plusToSpace,
-                                                UriBreakConversion breakConversion,
-                                                UriMemoryManager * memory);
+        int * itemCount, const URI_CHAR * first, const URI_CHAR * afterLast,
+        UriBool plusToSpace, UriBreakConversion breakConversion,
+        UriMemoryManager * memory);

 /**
  * Frees all memory associated with the given query list.
@@ -1117,8 +1094,8 @@ URI_PUBLIC void URI_FUNC(FreeQueryList)(URI_TYPE(QueryList) * queryList);
  * @see uriFreeQueryListA
  * @since 0.9.0
  */
-URI_PUBLIC int URI_FUNC(FreeQueryListMm)(URI_TYPE(QueryList) * queryList,
-                                         UriMemoryManager * memory);
+URI_PUBLIC int URI_FUNC(FreeQueryListMm)(
+        URI_TYPE(QueryList) * queryList, UriMemoryManager * memory);

 /**
  * Makes the %URI hold copies of strings so that it no longer depends
@@ -1171,8 +1148,8 @@ URI_PUBLIC int URI_FUNC(MakeOwnerMm)(URI_TYPE(Uri) * uri, UriMemoryManager * mem
  * @see uriSetFragmentMmA
  * @since 0.9.9
  */
-URI_PUBLIC UriBool URI_FUNC(IsWellFormedFragment)(const URI_CHAR * first,
-                                                  const URI_CHAR * afterLast);
+URI_PUBLIC UriBool URI_FUNC(IsWellFormedFragment)(
+        const URI_CHAR * first, const URI_CHAR * afterLast);

 /**
  * Determines if the given text range contains a well-formed IPv4 address
@@ -1196,8 +1173,8 @@ URI_PUBLIC UriBool URI_FUNC(IsWellFormedFragment)(const URI_CHAR * first,
  * @see uriSetHostIp4MmA
  * @since 0.9.9
  */
-URI_PUBLIC UriBool URI_FUNC(IsWellFormedHostIp4)(const URI_CHAR * first,
-                                                 const URI_CHAR * afterLast);
+URI_PUBLIC UriBool URI_FUNC(IsWellFormedHostIp4)(
+        const URI_CHAR * first, const URI_CHAR * afterLast);

 /**
  * Determines if the given text range contains a well-formed IPv6 address
@@ -1222,9 +1199,10 @@ URI_PUBLIC UriBool URI_FUNC(IsWellFormedHostIp4)(const URI_CHAR * first,
  * @see uriIsWellFormedUserInfoA
  * @see uriParseIpSixAddressA
  * @see uriParseIpSixAddressMmA
- * @since 0.9.9
+ * @since 1.0.3
  */
-int URI_FUNC(IsWellFormedHostIp6)(const URI_CHAR * first, const URI_CHAR * afterLast);
+URI_PUBLIC int URI_FUNC(IsWellFormedHostIp6)(
+        const URI_CHAR * first, const URI_CHAR * afterLast);

 /**
  * Determines if the given text range contains a well-formed IPv6 address
@@ -1246,10 +1224,10 @@ int URI_FUNC(IsWellFormedHostIp6)(const URI_CHAR * first, const URI_CHAR * after
  * @see uriIsWellFormedQueryA
  * @see uriIsWellFormedSchemeA
  * @see uriIsWellFormedUserInfoA
- * @since 0.9.9
+ * @since 1.0.3
  */
-int URI_FUNC(IsWellFormedHostIp6Mm)(const URI_CHAR * first, const URI_CHAR * afterLast,
-                                    UriMemoryManager * memory);
+URI_PUBLIC int URI_FUNC(IsWellFormedHostIp6Mm)(
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);

 /**
  * Determines if the given text range contains a well-formed IPvFuture address
@@ -1274,10 +1252,10 @@ int URI_FUNC(IsWellFormedHostIp6Mm)(const URI_CHAR * first, const URI_CHAR * aft
  * @see uriIsWellFormedUserInfoA
  * @see uriSetHostIpFutureA
  * @see uriSetHostIpFutureMmA
- * @since 0.9.9
+ * @since 1.0.3
  */
-int URI_FUNC(IsWellFormedHostIpFuture)(const URI_CHAR * first,
-                                       const URI_CHAR * afterLast);
+URI_PUBLIC int URI_FUNC(IsWellFormedHostIpFuture)(
+        const URI_CHAR * first, const URI_CHAR * afterLast);

 /**
  * Determines if the given text range contains a well-formed IPvFuture address
@@ -1301,11 +1279,10 @@ int URI_FUNC(IsWellFormedHostIpFuture)(const URI_CHAR * first,
  * @see uriIsWellFormedUserInfoA
  * @see uriSetHostIpFutureA
  * @see uriSetHostIpFutureMmA
- * @since 0.9.9
+ * @since 1.0.3
  */
-int URI_FUNC(IsWellFormedHostIpFutureMm)(const URI_CHAR * first,
-                                         const URI_CHAR * afterLast,
-                                         UriMemoryManager * memory);
+URI_PUBLIC int URI_FUNC(IsWellFormedHostIpFutureMm)(
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);

 /**
  * Determines if the given text range contains a well-formed registered host name
@@ -1329,8 +1306,8 @@ int URI_FUNC(IsWellFormedHostIpFutureMm)(const URI_CHAR * first,
  * @see uriSetHostRegNameMmA
  * @since 0.9.9
  */
-URI_PUBLIC UriBool URI_FUNC(IsWellFormedHostRegName)(const URI_CHAR * first,
-                                                     const URI_CHAR * afterLast);
+URI_PUBLIC UriBool URI_FUNC(IsWellFormedHostRegName)(
+        const URI_CHAR * first, const URI_CHAR * afterLast);

 /**
  * Determines if the given text range contains a well-formed path
@@ -1357,9 +1334,8 @@ URI_PUBLIC UriBool URI_FUNC(IsWellFormedHostRegName)(const URI_CHAR * first,
  * @see uriSetPathMmA
  * @since 0.9.9
  */
-URI_PUBLIC UriBool URI_FUNC(IsWellFormedPath)(const URI_CHAR * first,
-                                              const URI_CHAR * afterLast,
-                                              UriBool hasHost);
+URI_PUBLIC UriBool URI_FUNC(IsWellFormedPath)(
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriBool hasHost);

 /**
  * Determines if the given text range contains a well-formed port text
@@ -1383,8 +1359,8 @@ URI_PUBLIC UriBool URI_FUNC(IsWellFormedPath)(const URI_CHAR * first,
  * @see uriSetPortTextMmA
  * @since 0.9.9
  */
-URI_PUBLIC UriBool URI_FUNC(IsWellFormedPort)(const URI_CHAR * first,
-                                              const URI_CHAR * afterLast);
+URI_PUBLIC UriBool URI_FUNC(IsWellFormedPort)(
+        const URI_CHAR * first, const URI_CHAR * afterLast);

 /**
  * Determines if the given text range contains a well-formed query
@@ -1408,8 +1384,8 @@ URI_PUBLIC UriBool URI_FUNC(IsWellFormedPort)(const URI_CHAR * first,
  * @see uriSetQueryMmA
  * @since 0.9.9
  */
-URI_PUBLIC UriBool URI_FUNC(IsWellFormedQuery)(const URI_CHAR * first,
-                                               const URI_CHAR * afterLast);
+URI_PUBLIC UriBool URI_FUNC(IsWellFormedQuery)(
+        const URI_CHAR * first, const URI_CHAR * afterLast);

 /**
  * Determines if the given text range contains a well-formed scheme
@@ -1434,8 +1410,8 @@ URI_PUBLIC UriBool URI_FUNC(IsWellFormedQuery)(const URI_CHAR * first,
  * @see uriSetSchemeMmA
  * @since 0.9.9
  */
-URI_PUBLIC UriBool URI_FUNC(IsWellFormedScheme)(const URI_CHAR * first,
-                                                const URI_CHAR * afterLast);
+URI_PUBLIC UriBool URI_FUNC(IsWellFormedScheme)(
+        const URI_CHAR * first, const URI_CHAR * afterLast);

 /**
  * Determines if the given text range contains a well-formed user info
@@ -1459,8 +1435,8 @@ URI_PUBLIC UriBool URI_FUNC(IsWellFormedScheme)(const URI_CHAR * first,
  * @see uriSetUserInfoMmA
  * @since 0.9.9
  */
-URI_PUBLIC UriBool URI_FUNC(IsWellFormedUserInfo)(const URI_CHAR * first,
-                                                  const URI_CHAR * afterLast);
+URI_PUBLIC UriBool URI_FUNC(IsWellFormedUserInfo)(
+        const URI_CHAR * first, const URI_CHAR * afterLast);

 /**
  * Sets the fragment of the given %URI to the given value.
@@ -1495,8 +1471,8 @@ URI_PUBLIC UriBool URI_FUNC(IsWellFormedUserInfo)(const URI_CHAR * first,
  * @see uriSetUserInfoA
  * @since 0.9.9
  */
-URI_PUBLIC int URI_FUNC(SetFragment)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                                     const URI_CHAR * afterLast);
+URI_PUBLIC int URI_FUNC(SetFragment)(
+        URI_TYPE(Uri) * uri, const URI_CHAR * first, const URI_CHAR * afterLast);

 /**
  * Sets the fragment of the given %URI to the given value.
@@ -1531,8 +1507,7 @@ URI_PUBLIC int URI_FUNC(SetFragment)(URI_TYPE(Uri) * uri, const URI_CHAR * first
  * @since 0.9.9
  */
 URI_PUBLIC int URI_FUNC(SetFragmentMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                                       const URI_CHAR * afterLast,
-                                       UriMemoryManager * memory);
+        const URI_CHAR * afterLast, UriMemoryManager * memory);

 /**
  * Sets the host of the given %URI to the given value.
@@ -1572,8 +1547,8 @@ URI_PUBLIC int URI_FUNC(SetFragmentMm)(URI_TYPE(Uri) * uri, const URI_CHAR * fir
  * @see uriSetUserInfoA
  * @since 0.9.9
  */
-URI_PUBLIC int URI_FUNC(SetHostAuto)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                                     const URI_CHAR * afterLast);
+URI_PUBLIC int URI_FUNC(SetHostAuto)(
+        URI_TYPE(Uri) * uri, const URI_CHAR * first, const URI_CHAR * afterLast);

 /**
  * Sets the host of the given %URI to the given value.
@@ -1613,8 +1588,7 @@ URI_PUBLIC int URI_FUNC(SetHostAuto)(URI_TYPE(Uri) * uri, const URI_CHAR * first
  * @since 0.9.9
  */
 URI_PUBLIC int URI_FUNC(SetHostAutoMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                                       const URI_CHAR * afterLast,
-                                       UriMemoryManager * memory);
+        const URI_CHAR * afterLast, UriMemoryManager * memory);

 /**
  * Sets the host of the given %URI to the given value.
@@ -1649,8 +1623,8 @@ URI_PUBLIC int URI_FUNC(SetHostAutoMm)(URI_TYPE(Uri) * uri, const URI_CHAR * fir
  * @see uriSetUserInfoA
  * @since 0.9.9
  */
-URI_PUBLIC int URI_FUNC(SetHostRegName)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                                        const URI_CHAR * afterLast);
+URI_PUBLIC int URI_FUNC(SetHostRegName)(
+        URI_TYPE(Uri) * uri, const URI_CHAR * first, const URI_CHAR * afterLast);

 /**
  * Sets the host of the given %URI to the given value.
@@ -1685,8 +1659,7 @@ URI_PUBLIC int URI_FUNC(SetHostRegName)(URI_TYPE(Uri) * uri, const URI_CHAR * fi
  * @since 0.9.9
  */
 URI_PUBLIC int URI_FUNC(SetHostRegNameMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                                          const URI_CHAR * afterLast,
-                                          UriMemoryManager * memory);
+        const URI_CHAR * afterLast, UriMemoryManager * memory);

 /**
  * Sets the host of the given %URI to the given value.
@@ -1721,8 +1694,8 @@ URI_PUBLIC int URI_FUNC(SetHostRegNameMm)(URI_TYPE(Uri) * uri, const URI_CHAR *
  * @see uriSetUserInfoA
  * @since 0.9.9
  */
-URI_PUBLIC int URI_FUNC(SetHostIp4)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                                    const URI_CHAR * afterLast);
+URI_PUBLIC int URI_FUNC(SetHostIp4)(
+        URI_TYPE(Uri) * uri, const URI_CHAR * first, const URI_CHAR * afterLast);

 /**
  * Sets the host of the given %URI to the given value.
@@ -1757,8 +1730,7 @@ URI_PUBLIC int URI_FUNC(SetHostIp4)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
  * @since 0.9.9
  */
 URI_PUBLIC int URI_FUNC(SetHostIp4Mm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                                      const URI_CHAR * afterLast,
-                                      UriMemoryManager * memory);
+        const URI_CHAR * afterLast, UriMemoryManager * memory);

 /**
  * Sets the host of the given %URI to the given value.
@@ -1793,8 +1765,8 @@ URI_PUBLIC int URI_FUNC(SetHostIp4Mm)(URI_TYPE(Uri) * uri, const URI_CHAR * firs
  * @see uriSetUserInfoA
  * @since 0.9.9
  */
-URI_PUBLIC int URI_FUNC(SetHostIp6)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                                    const URI_CHAR * afterLast);
+URI_PUBLIC int URI_FUNC(SetHostIp6)(
+        URI_TYPE(Uri) * uri, const URI_CHAR * first, const URI_CHAR * afterLast);

 /**
  * Sets the host of the given %URI to the given value.
@@ -1829,8 +1801,7 @@ URI_PUBLIC int URI_FUNC(SetHostIp6)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
  * @since 0.9.9
  */
 URI_PUBLIC int URI_FUNC(SetHostIp6Mm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                                      const URI_CHAR * afterLast,
-                                      UriMemoryManager * memory);
+        const URI_CHAR * afterLast, UriMemoryManager * memory);

 /**
  * Sets the host of the given %URI to the given value.
@@ -1865,8 +1836,8 @@ URI_PUBLIC int URI_FUNC(SetHostIp6Mm)(URI_TYPE(Uri) * uri, const URI_CHAR * firs
  * @see uriSetUserInfoA
  * @since 0.9.9
  */
-URI_PUBLIC int URI_FUNC(SetHostIpFuture)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                                         const URI_CHAR * afterLast);
+URI_PUBLIC int URI_FUNC(SetHostIpFuture)(
+        URI_TYPE(Uri) * uri, const URI_CHAR * first, const URI_CHAR * afterLast);

 /**
  * Sets the host of the given %URI to the given value.
@@ -1901,8 +1872,7 @@ URI_PUBLIC int URI_FUNC(SetHostIpFuture)(URI_TYPE(Uri) * uri, const URI_CHAR * f
  * @since 0.9.9
  */
 URI_PUBLIC int URI_FUNC(SetHostIpFutureMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                                           const URI_CHAR * afterLast,
-                                           UriMemoryManager * memory);
+        const URI_CHAR * afterLast, UriMemoryManager * memory);

 /**
  * Sets the path of the given %URI to the given value.
@@ -1940,8 +1910,8 @@ URI_PUBLIC int URI_FUNC(SetHostIpFutureMm)(URI_TYPE(Uri) * uri, const URI_CHAR *
  * @see uriSetUserInfoA
  * @since 0.9.9
  */
-URI_PUBLIC int URI_FUNC(SetPath)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                                 const URI_CHAR * afterLast);
+URI_PUBLIC int URI_FUNC(SetPath)(
+        URI_TYPE(Uri) * uri, const URI_CHAR * first, const URI_CHAR * afterLast);

 /**
  * Sets the path of the given %URI to the given value.
@@ -1981,7 +1951,7 @@ URI_PUBLIC int URI_FUNC(SetPath)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
  * @since 0.9.9
  */
 URI_PUBLIC int URI_FUNC(SetPathMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                                   const URI_CHAR * afterLast, UriMemoryManager * memory);
+        const URI_CHAR * afterLast, UriMemoryManager * memory);

 /**
  * Sets the port text of the given %URI to the given value.
@@ -2018,8 +1988,8 @@ URI_PUBLIC int URI_FUNC(SetPathMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
  * @see uriSetUserInfoA
  * @since 0.9.9
  */
-URI_PUBLIC int URI_FUNC(SetPortText)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                                     const URI_CHAR * afterLast);
+URI_PUBLIC int URI_FUNC(SetPortText)(
+        URI_TYPE(Uri) * uri, const URI_CHAR * first, const URI_CHAR * afterLast);

 /**
  * Sets the port text of the given %URI to the given value.
@@ -2056,8 +2026,7 @@ URI_PUBLIC int URI_FUNC(SetPortText)(URI_TYPE(Uri) * uri, const URI_CHAR * first
  * @since 0.9.9
  */
 URI_PUBLIC int URI_FUNC(SetPortTextMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                                       const URI_CHAR * afterLast,
-                                       UriMemoryManager * memory);
+        const URI_CHAR * afterLast, UriMemoryManager * memory);

 /**
  * Sets the query of the given %URI to the given value.
@@ -2092,8 +2061,8 @@ URI_PUBLIC int URI_FUNC(SetPortTextMm)(URI_TYPE(Uri) * uri, const URI_CHAR * fir
  * @see uriSetUserInfoA
  * @since 0.9.9
  */
-URI_PUBLIC int URI_FUNC(SetQuery)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                                  const URI_CHAR * afterLast);
+URI_PUBLIC int URI_FUNC(SetQuery)(
+        URI_TYPE(Uri) * uri, const URI_CHAR * first, const URI_CHAR * afterLast);

 /**
  * Sets the query of the given %URI to the given value.
@@ -2128,8 +2097,7 @@ URI_PUBLIC int URI_FUNC(SetQuery)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
  * @since 0.9.9
  */
 URI_PUBLIC int URI_FUNC(SetQueryMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                                    const URI_CHAR * afterLast,
-                                    UriMemoryManager * memory);
+        const URI_CHAR * afterLast, UriMemoryManager * memory);

 /**
  * Sets the scheme of the given %URI to the given value.
@@ -2164,8 +2132,8 @@ URI_PUBLIC int URI_FUNC(SetQueryMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
  * @see uriSetUserInfoA
  * @since 0.9.9
  */
-URI_PUBLIC int URI_FUNC(SetScheme)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                                   const URI_CHAR * afterLast);
+URI_PUBLIC int URI_FUNC(SetScheme)(
+        URI_TYPE(Uri) * uri, const URI_CHAR * first, const URI_CHAR * afterLast);

 /**
  * Sets the scheme of the given %URI to the given value.
@@ -2200,8 +2168,7 @@ URI_PUBLIC int URI_FUNC(SetScheme)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
  * @since 0.9.9
  */
 URI_PUBLIC int URI_FUNC(SetSchemeMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                                     const URI_CHAR * afterLast,
-                                     UriMemoryManager * memory);
+        const URI_CHAR * afterLast, UriMemoryManager * memory);

 /**
  * Sets the user info of the given %URI to the given value.
@@ -2238,8 +2205,8 @@ URI_PUBLIC int URI_FUNC(SetSchemeMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first
  * @see uriSetUserInfoMmA
  * @since 0.9.9
  */
-URI_PUBLIC int URI_FUNC(SetUserInfo)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                                     const URI_CHAR * afterLast);
+URI_PUBLIC int URI_FUNC(SetUserInfo)(
+        URI_TYPE(Uri) * uri, const URI_CHAR * first, const URI_CHAR * afterLast);

 /**
  * Sets the user info of the given %URI to the given value.
@@ -2276,8 +2243,7 @@ URI_PUBLIC int URI_FUNC(SetUserInfo)(URI_TYPE(Uri) * uri, const URI_CHAR * first
  * @since 0.9.9
  */
 URI_PUBLIC int URI_FUNC(SetUserInfoMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                                       const URI_CHAR * afterLast,
-                                       UriMemoryManager * memory);
+        const URI_CHAR * afterLast, UriMemoryManager * memory);

 /**
  * Obtain the base runtime version of uriparser.
diff --git a/ext/uri/uriparser/include/uriparser/UriBase.h b/ext/uri/uriparser/include/uriparser/UriBase.h
index 1cc91ceab77..731a4c977db 100644
--- a/ext/uri/uriparser/include/uriparser/UriBase.h
+++ b/ext/uri/uriparser/include/uriparser/UriBase.h
@@ -52,7 +52,7 @@
 /* Version */
 #  define URI_VER_MAJOR 1
 #  define URI_VER_MINOR 0
-#  define URI_VER_RELEASE 2
+#  define URI_VER_RELEASE 3
 #  define URI_VER_SUFFIX_ANSI ""
 #  define URI_VER_SUFFIX_UNICODE URI_ANSI_TO_UNICODE(URI_VER_SUFFIX_ANSI)

@@ -71,11 +71,11 @@

 /* Full version strings */
 #  define URI_VER_ANSI \
-      URI_VER_ANSI_HELPER(URI_VER_MAJOR, URI_VER_MINOR, URI_VER_RELEASE, \
-                          URI_VER_SUFFIX_ANSI)
+      URI_VER_ANSI_HELPER( \
+              URI_VER_MAJOR, URI_VER_MINOR, URI_VER_RELEASE, URI_VER_SUFFIX_ANSI)
 #  define URI_VER_UNICODE \
-      URI_VER_UNICODE_HELPER(URI_VER_MAJOR, URI_VER_MINOR, URI_VER_RELEASE, \
-                             URI_VER_SUFFIX_UNICODE)
+      URI_VER_UNICODE_HELPER( \
+              URI_VER_MAJOR, URI_VER_MINOR, URI_VER_RELEASE, URI_VER_SUFFIX_UNICODE)

 /* Unused parameter macro */
 #  ifdef __GNUC__
@@ -200,8 +200,8 @@ typedef void * (*UriFuncRealloc)(struct UriMemoryManagerStruct *, void *, size_t
  *
  * @since 0.9.0
  */
-typedef void * (*UriFuncReallocarray)(struct UriMemoryManagerStruct *, void *, size_t,
-                                      size_t);
+typedef void * (*UriFuncReallocarray)(
+        struct UriMemoryManagerStruct *, void *, size_t, size_t);

 /**
  * Function signature that custom free(3) functions must conform to
@@ -227,8 +227,8 @@ typedef struct UriMemoryManagerStruct {
     UriFuncReallocarray reallocarray; /**< Pointer to custom reallocarray(3); to emulate
                                          using realloc see uriEmulateReallocarray */
     UriFuncFree free; /**< Pointer to custom free(3) */
-    void *
-        userData; /**< Pointer to data that the other function members need access to */
+    void * userData; /**< Pointer to data that the other function members need access to
+                      */
 } UriMemoryManager; /**< @copydoc UriMemoryManagerStruct */

 /**
@@ -240,7 +240,7 @@ typedef enum UriBreakConversionEnum {
     URI_BR_TO_CR, /**< Convert to Macintosh line breaks ("\\x0d") */
     URI_BR_TO_UNIX = URI_BR_TO_LF, /**< @copydoc UriBreakConversionEnum::URI_BR_TO_LF */
     URI_BR_TO_WINDOWS =
-        URI_BR_TO_CRLF, /**< @copydoc UriBreakConversionEnum::URI_BR_TO_CRLF */
+            URI_BR_TO_CRLF, /**< @copydoc UriBreakConversionEnum::URI_BR_TO_CRLF */
     URI_BR_TO_MAC = URI_BR_TO_CR, /**< @copydoc UriBreakConversionEnum::URI_BR_TO_CR */
     URI_BR_DONT_TOUCH /**< Copy line breaks unmodified */
 } UriBreakConversion; /**< @copydoc UriBreakConversionEnum */
@@ -251,15 +251,15 @@ typedef enum UriBreakConversionEnum {
 typedef enum UriNormalizationMaskEnum {
     URI_NORMALIZED = 0, /**< Do not normalize anything */
     URI_NORMALIZE_SCHEME = 1 << 0, /**< Normalize scheme (fix uppercase letters) */
-    URI_NORMALIZE_USER_INFO =
-        1 << 1, /**< Normalize user info (fix uppercase percent-encodings) */
+    URI_NORMALIZE_USER_INFO = 1
+            << 1, /**< Normalize user info (fix uppercase percent-encodings) */
     URI_NORMALIZE_HOST = 1 << 2, /**< Normalize host (fix uppercase letters) */
     URI_NORMALIZE_PATH = 1 << 3, /**< Normalize path (fix uppercase percent-encodings and
                                     redundant dot segments) */
-    URI_NORMALIZE_QUERY =
-        1 << 4, /**< Normalize query (fix uppercase percent-encodings) */
-    URI_NORMALIZE_FRAGMENT =
-        1 << 5, /**< Normalize fragment (fix uppercase percent-encodings) */
+    URI_NORMALIZE_QUERY = 1
+            << 4, /**< Normalize query (fix uppercase percent-encodings) */
+    URI_NORMALIZE_FRAGMENT = 1
+            << 5, /**< Normalize fragment (fix uppercase percent-encodings) */
     URI_NORMALIZE_PORT = 1 << 6 /**< Normalize port (drop leading zeros) @since 0.9.9 */
 } UriNormalizationMask; /**< @copydoc UriNormalizationMaskEnum */

@@ -268,8 +268,8 @@ typedef enum UriNormalizationMaskEnum {
  */
 typedef enum UriResolutionOptionsEnum {
     URI_RESOLVE_STRICTLY = 0, /**< Full RFC conformance */
-    URI_RESOLVE_IDENTICAL_SCHEME_COMPAT =
-        1 << 0 /**< Treat %URI to resolve with identical scheme as having no scheme */
+    URI_RESOLVE_IDENTICAL_SCHEME_COMPAT = 1
+            << 0 /**< Treat %URI to resolve with identical scheme as having no scheme */
 } UriResolutionOptions; /**< @copydoc UriResolutionOptionsEnum */

 /**
@@ -307,8 +307,8 @@ typedef enum UriResolutionOptionsEnum {
  * @see UriMemoryManager
  * @since 0.9.0
  */
-URI_PUBLIC int uriCompleteMemoryManager(UriMemoryManager * memory,
-                                        UriMemoryManager * backend);
+URI_PUBLIC int uriCompleteMemoryManager(
+        UriMemoryManager * memory, UriMemoryManager * backend);

 /**
  * Offers emulation of calloc(3) based on memory-&gt;malloc and memset.
@@ -341,8 +341,8 @@ URI_PUBLIC void * uriEmulateCalloc(UriMemoryManager * memory, size_t nmemb, size
  * @see UriMemoryManager
  * @since 0.9.0
  */
-URI_PUBLIC void * uriEmulateReallocarray(UriMemoryManager * memory, void * ptr,
-                                         size_t nmemb, size_t size);
+URI_PUBLIC void * uriEmulateReallocarray(
+        UriMemoryManager * memory, void * ptr, size_t nmemb, size_t size);

 /**
  * Run multiple tests against a given memory manager.
@@ -396,7 +396,7 @@ URI_PUBLIC int uriTestMemoryManager(UriMemoryManager * memory);
  * @see uriTestMemoryManager
  * @since 1.0.0
  */
-URI_PUBLIC int uriTestMemoryManagerEx(UriMemoryManager * memory,
-                                      UriBool challengeAlignment);
+URI_PUBLIC int uriTestMemoryManagerEx(
+        UriMemoryManager * memory, UriBool challengeAlignment);

 #endif /* URI_BASE_H */
diff --git a/ext/uri/uriparser/include/uriparser/UriIp4.h b/ext/uri/uriparser/include/uriparser/UriIp4.h
index 5f84b62dd2f..cdbead83e43 100644
--- a/ext/uri/uriparser/include/uriparser/UriIp4.h
+++ b/ext/uri/uriparser/include/uriparser/UriIp4.h
@@ -44,8 +44,8 @@
  */

 #if (defined(URI_PASS_ANSI) && !defined(URI_IP4_TWICE_H_ANSI)) \
-    || (defined(URI_PASS_UNICODE) && !defined(URI_IP4_TWICE_H_UNICODE)) \
-    || (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
+        || (defined(URI_PASS_UNICODE) && !defined(URI_IP4_TWICE_H_UNICODE)) \
+        || (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
 /* What encodings are enabled? */
 #  include "UriDefsConfig.h"
 #  if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
@@ -62,9 +62,9 @@
 #    endif
 /* Only one pass for each encoding */
 #  elif (defined(URI_PASS_ANSI) && !defined(URI_IP4_TWICE_H_ANSI) \
-         && defined(URI_ENABLE_ANSI)) \
-      || (defined(URI_PASS_UNICODE) && !defined(URI_IP4_TWICE_H_UNICODE) \
-          && defined(URI_ENABLE_UNICODE))
+          && defined(URI_ENABLE_ANSI)) \
+          || (defined(URI_PASS_UNICODE) && !defined(URI_IP4_TWICE_H_UNICODE) \
+                  && defined(URI_ENABLE_UNICODE))
 #    ifdef URI_PASS_ANSI
 #      define URI_IP4_TWICE_H_ANSI 1
 #      include "UriDefsAnsi.h"
@@ -93,9 +93,8 @@ extern "C" {
  * @see uriParseIpSixAddressA
  * @see uriParseIpSixAddressMmA
  */
-URI_PUBLIC int URI_FUNC(ParseIpFourAddress)(unsigned char * octetOutput,
-                                            const URI_CHAR * first,
-                                            const URI_CHAR * afterLast);
+URI_PUBLIC int URI_FUNC(ParseIpFourAddress)(
+        unsigned char * octetOutput, const URI_CHAR * first, const URI_CHAR * afterLast);

 #    ifdef __cplusplus
 }
diff --git a/ext/uri/uriparser/src/UriCommon.c b/ext/uri/uriparser/src/UriCommon.c
index e9a6992b01c..6f36ea99ce5 100644
--- a/ext/uri/uriparser/src/UriCommon.c
+++ b/ext/uri/uriparser/src/UriCommon.c
@@ -89,7 +89,7 @@ int URI_FUNC(FreeUriPath)(URI_TYPE(Uri) * uri, UriMemoryManager * memory) {
         while (segWalk != NULL) {
             URI_TYPE(PathSegment) * const next = segWalk->next;
             if ((uri->owner == URI_TRUE)
-                && (segWalk->text.first != segWalk->text.afterLast)) {
+                    && (segWalk->text.first != segWalk->text.afterLast)) {
                 memory->free(memory, (URI_CHAR *)segWalk->text.first);
             }
             segWalk->text.first = NULL;
@@ -128,8 +128,7 @@ bool URI_FUNC(RangeEquals)(const URI_TYPE(TextRange) * a, const URI_TYPE(TextRan
 }

 UriBool URI_FUNC(CopyRange)(URI_TYPE(TextRange) * destRange,
-                            const URI_TYPE(TextRange) * sourceRange,
-                            UriMemoryManager * memory) {
+        const URI_TYPE(TextRange) * sourceRange, UriMemoryManager * memory) {
     const size_t lenInChars = sourceRange->afterLast - sourceRange->first;
     if (lenInChars > SIZE_MAX / sizeof(URI_CHAR)) {  // detect integer overflow
         return URI_FALSE;
@@ -147,8 +146,7 @@ UriBool URI_FUNC(CopyRange)(URI_TYPE(TextRange) * destRange,
 }

 UriBool URI_FUNC(CopyRangeAsNeeded)(URI_TYPE(TextRange) * destRange,
-                                    const URI_TYPE(TextRange) * sourceRange,
-                                    UriMemoryManager * memory) {
+        const URI_TYPE(TextRange) * sourceRange, UriMemoryManager * memory) {
     if (sourceRange->first == NULL) {
         destRange->first = NULL;
         destRange->afterLast = NULL;
@@ -163,7 +161,7 @@ UriBool URI_FUNC(CopyRangeAsNeeded)(URI_TYPE(TextRange) * destRange,
 }

 UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri, UriBool relative,
-                                      UriBool pathOwned, UriMemoryManager * memory) {
+        UriBool pathOwned, UriMemoryManager * memory) {
     URI_TYPE(PathSegment) * walker;
     if ((uri == NULL) || (uri->pathHead == NULL)) {
         return URI_TRUE;
@@ -198,7 +196,7 @@ UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri, UriBool relative,
                 if ((walker == uri->pathHead) && (walker->next != NULL)) {
                     /* Detect case "/.//" (with or without scheme) */
                     if ((walker->next->text.first == walker->next->text.afterLast)
-                        && (URI_FUNC(HasHost)(uri) == URI_FALSE)) {
+                            && (URI_FUNC(HasHost)(uri) == URI_FALSE)) {
                         removeSegment = URI_FALSE;
                         /* Detect case "./withcolon:" */
                     } else if (relative) {
@@ -271,7 +269,7 @@ UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri, UriBool relative,

         case 2:
             if (((walker->text.first)[0] == _UT('.'))
-                && ((walker->text.first)[1] == _UT('.'))) {
+                    && ((walker->text.first)[1] == _UT('.'))) {
                 /* Path ".." -> remove this and the previous segment */
                 URI_TYPE(PathSegment) * const prev = walker->reserved;
                 URI_TYPE(PathSegment) * prevPrev;
@@ -314,20 +312,21 @@ UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri, UriBool relative,
                                 /* Last segment -> insert "" segment to represent trailing
                                  * slash, update tail */
                                 URI_TYPE(PathSegment) * const segment = memory->calloc(
-                                    memory, 1, sizeof(URI_TYPE(PathSegment)));
+                                        memory, 1, sizeof(URI_TYPE(PathSegment)));
                                 if (segment == NULL) {
                                     if (pathOwned
-                                        && (walker->text.first
-                                            != walker->text.afterLast)) {
-                                        memory->free(memory,
-                                                     (URI_CHAR *)walker->text.first);
+                                            && (walker->text.first
+                                                    != walker->text.afterLast)) {
+                                        memory->free(
+                                                memory, (URI_CHAR *)walker->text.first);
                                     }
                                     memory->free(memory, walker);

                                     if (pathOwned
-                                        && (prev->text.first != prev->text.afterLast)) {
-                                        memory->free(memory,
-                                                     (URI_CHAR *)prev->text.first);
+                                            && (prev->text.first
+                                                    != prev->text.afterLast)) {
+                                        memory->free(
+                                                memory, (URI_CHAR *)prev->text.first);
                                     }
                                     memory->free(memory, prev);

@@ -340,7 +339,7 @@ UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri, UriBool relative,
                             }

                             if (pathOwned
-                                && (walker->text.first != walker->text.afterLast)) {
+                                    && (walker->text.first != walker->text.afterLast)) {
                                 memory->free(memory, (URI_CHAR *)walker->text.first);
                             }
                             memory->free(memory, walker);
@@ -358,7 +357,8 @@ UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri, UriBool relative,
                                 walker->next->reserved = NULL;

                                 if (pathOwned
-                                    && (walker->text.first != walker->text.afterLast)) {
+                                        && (walker->text.first
+                                                != walker->text.afterLast)) {
                                     memory->free(memory, (URI_CHAR *)walker->text.first);
                                 }
                                 memory->free(memory, walker);
@@ -367,7 +367,8 @@ UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri, UriBool relative,
                                  * slash, update tail */
                                 URI_TYPE(PathSegment) * const segment = walker;
                                 if (pathOwned
-                                    && (segment->text.first != segment->text.afterLast)) {
+                                        && (segment->text.first
+                                                != segment->text.afterLast)) {
                                     memory->free(memory, (URI_CHAR *)segment->text.first);
                                 }
                                 segment->text.first = URI_FUNC(SafeToPointTo);
@@ -413,7 +414,8 @@ UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri, UriBool relative,
                                 /* Reuse segment for "" path segment to represent trailing
                                  * slash, then update head and tail */
                                 if (pathOwned
-                                    && (walker->text.first != walker->text.afterLast)) {
+                                        && (walker->text.first
+                                                != walker->text.afterLast)) {
                                     memory->free(memory, (URI_CHAR *)walker->text.first);
                                 }
                                 walker->text.first = URI_FUNC(SafeToPointTo);
@@ -424,7 +426,7 @@ UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri, UriBool relative,

                         if (freeWalker) {
                             if (pathOwned
-                                && (walker->text.first != walker->text.afterLast)) {
+                                    && (walker->text.first != walker->text.afterLast)) {
                                 memory->free(memory, (URI_CHAR *)walker->text.first);
                             }
                             memory->free(memory, walker);
@@ -453,8 +455,8 @@ UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri, UriBool relative,
 }

 /* Properly removes "." and ".." path segments */
-UriBool URI_FUNC(RemoveDotSegmentsAbsolute)(URI_TYPE(Uri) * uri,
-                                            UriMemoryManager * memory) {
+UriBool URI_FUNC(RemoveDotSegmentsAbsolute)(
+        URI_TYPE(Uri) * uri, UriMemoryManager * memory) {
     const UriBool ABSOLUTE = URI_FALSE;
     if (uri == NULL) {
         return URI_TRUE;
@@ -523,12 +525,12 @@ UriBool URI_FUNC(HasHost)(const URI_TYPE(Uri) * uri) {
      *       no more information to be gained.                */
     return (uri != NULL)
            && ((uri->hostText.first != NULL) || (uri->hostData.ip4 != NULL)
-               || (uri->hostData.ip6 != NULL));
+                   || (uri->hostData.ip6 != NULL));
 }

 /* Copies the path segment list from one URI to another. */
-UriBool URI_FUNC(CopyPath)(URI_TYPE(Uri) * dest, const URI_TYPE(Uri) * source,
-                           UriMemoryManager * memory) {
+UriBool URI_FUNC(CopyPath)(
+        URI_TYPE(Uri) * dest, const URI_TYPE(Uri) * source, UriMemoryManager * memory) {
     if (source->pathHead == NULL) {
         /* No path component */
         dest->pathHead = NULL;
@@ -539,7 +541,7 @@ UriBool URI_FUNC(CopyPath)(URI_TYPE(Uri) * dest, const URI_TYPE(Uri) * source,
         URI_TYPE(PathSegment) * destPrev = NULL;
         do {
             URI_TYPE(PathSegment) * cur =
-                memory->malloc(memory, sizeof(URI_TYPE(PathSegment)));
+                    memory->malloc(memory, sizeof(URI_TYPE(PathSegment)));
             if (cur == NULL) {
                 /* Fix broken list */
                 if (destPrev != NULL) {
@@ -569,8 +571,8 @@ UriBool URI_FUNC(CopyPath)(URI_TYPE(Uri) * dest, const URI_TYPE(Uri) * source,
 }

 /* Copies the authority part of an URI over to another. */
-UriBool URI_FUNC(CopyAuthority)(URI_TYPE(Uri) * dest, const URI_TYPE(Uri) * source,
-                                UriMemoryManager * memory) {
+UriBool URI_FUNC(CopyAuthority)(
+        URI_TYPE(Uri) * dest, const URI_TYPE(Uri) * source, UriMemoryManager * memory) {
     /* From this functions usage we know that *
      * the dest URI cannot be uri->owner      */

@@ -615,14 +617,15 @@ UriBool URI_FUNC(FixAmbiguity)(URI_TYPE(Uri) * uri, UriMemoryManager * memory) {
     URI_TYPE(PathSegment) * segment;

     if (/* Case 1: absolute path, empty first segment */
-        (uri->absolutePath && (uri->pathHead != NULL)
-         && (uri->pathHead->text.afterLast == uri->pathHead->text.first))
-
-        /* Case 2: relative path, empty first and second segment */
-        || (!uri->absolutePath && (uri->pathHead != NULL) && (uri->pathHead->next != NULL)
-            && (uri->pathHead->text.afterLast == uri->pathHead->text.first)
-            && (uri->pathHead->next->text.afterLast
-                == uri->pathHead->next->text.first))) {
+            (uri->absolutePath && (uri->pathHead != NULL)
+                    && (uri->pathHead->text.afterLast == uri->pathHead->text.first))
+
+            /* Case 2: relative path, empty first and second segment */
+            || (!uri->absolutePath && (uri->pathHead != NULL)
+                    && (uri->pathHead->next != NULL)
+                    && (uri->pathHead->text.afterLast == uri->pathHead->text.first)
+                    && (uri->pathHead->next->text.afterLast
+                            == uri->pathHead->next->text.first))) {
         /* NOOP */
     } else {
         return URI_TRUE;
@@ -641,13 +644,13 @@ UriBool URI_FUNC(FixAmbiguity)(URI_TYPE(Uri) * uri, UriMemoryManager * memory) {
     return URI_TRUE;
 }

-static UriBool URI_FUNC(PrependNewDotSegment)(URI_TYPE(Uri) * uri,
-                                              UriMemoryManager * memory) {
+static UriBool URI_FUNC(PrependNewDotSegment)(
+        URI_TYPE(Uri) * uri, UriMemoryManager * memory) {
     assert(uri != NULL);
     assert(memory != NULL);

     URI_TYPE(PathSegment) * const segment =
-        memory->malloc(memory, 1 * sizeof(URI_TYPE(PathSegment)));
+            memory->malloc(memory, 1 * sizeof(URI_TYPE(PathSegment)));

     if (segment == NULL) {
         return URI_FALSE; /* i.e. raise malloc error */
@@ -695,7 +698,7 @@ UriBool URI_FUNC(FixPathNoScheme)(URI_TYPE(Uri) * uri, UriMemoryManager * memory
     assert(memory != NULL);

     if ((uri->absolutePath == URI_TRUE) || (uri->pathHead == NULL)
-        || (uri->scheme.first != NULL) || URI_FUNC(HasHost)(uri)) {
+            || (uri->scheme.first != NULL) || URI_FUNC(HasHost)(uri)) {
         return URI_TRUE; /* i.e. nothing to do */
     }

@@ -735,15 +738,15 @@ UriBool URI_FUNC(FixPathNoScheme)(URI_TYPE(Uri) * uri, UriMemoryManager * memory
  * Returns URI_TRUE for (a) nothing to do or (b) successful changes.
  * Returns URI_FALSE to signal out-of-memory.
  */
-UriBool URI_FUNC(EnsureThatPathIsNotMistakenForHost)(URI_TYPE(Uri) * uri,
-                                                     UriMemoryManager * memory) {
+UriBool URI_FUNC(EnsureThatPathIsNotMistakenForHost)(
+        URI_TYPE(Uri) * uri, UriMemoryManager * memory) {
     assert(uri != NULL);
     assert(memory != NULL);

     if ((URI_FUNC(HasHost)(uri) == URI_TRUE) || (uri->absolutePath == URI_FALSE)
-        || (uri->pathHead == NULL)
-        || (uri->pathHead == uri->pathTail) /* i.e. no second slash */
-        || (uri->pathHead->text.first != uri->pathHead->text.afterLast)) {
+            || (uri->pathHead == NULL)
+            || (uri->pathHead == uri->pathTail) /* i.e. no second slash */
+            || (uri->pathHead->text.first != uri->pathHead->text.afterLast)) {
         return URI_TRUE; /* i.e. nothing to do */
     }

@@ -754,8 +757,8 @@ UriBool URI_FUNC(EnsureThatPathIsNotMistakenForHost)(URI_TYPE(Uri) * uri,
 void URI_FUNC(FixEmptyTrailSegment)(URI_TYPE(Uri) * uri, UriMemoryManager * memory) {
     /* Fix path if only one empty segment */
     if (!uri->absolutePath && !URI_FUNC(HasHost)(uri) && (uri->pathHead != NULL)
-        && (uri->pathHead->next == NULL)
-        && (uri->pathHead->text.first == uri->pathHead->text.afterLast)) {
+            && (uri->pathHead->next == NULL)
+            && (uri->pathHead->text.first == uri->pathHead->text.afterLast)) {
         memory->free(memory, uri->pathHead);
         uri->pathHead = NULL;
         uri->pathTail = NULL;
diff --git a/ext/uri/uriparser/src/UriCommon.h b/ext/uri/uriparser/src/UriCommon.h
index 12c691a7338..c1d69043a58 100644
--- a/ext/uri/uriparser/src/UriCommon.h
+++ b/ext/uri/uriparser/src/UriCommon.h
@@ -38,8 +38,8 @@
  */

 #if (defined(URI_PASS_ANSI) && !defined(URI_COMMON_H_ANSI)) \
-    || (defined(URI_PASS_UNICODE) && !defined(URI_COMMON_H_UNICODE)) \
-    || (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
+        || (defined(URI_PASS_UNICODE) && !defined(URI_COMMON_H_UNICODE)) \
+        || (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
 /* What encodings are enabled? */
 #  include <uriparser/UriDefsConfig.h>
 #  if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
@@ -56,9 +56,9 @@
 #    endif
 /* Only one pass for each encoding */
 #  elif (defined(URI_PASS_ANSI) && !defined(URI_COMMON_H_ANSI) \
-         && defined(URI_ENABLE_ANSI)) \
-      || (defined(URI_PASS_UNICODE) && !defined(URI_COMMON_H_UNICODE) \
-          && defined(URI_ENABLE_UNICODE))
+          && defined(URI_ENABLE_ANSI)) \
+          || (defined(URI_PASS_UNICODE) && !defined(URI_COMMON_H_UNICODE) \
+                  && defined(URI_ENABLE_UNICODE))
 #    ifdef URI_PASS_ANSI
 #      define URI_COMMON_H_ANSI 1
 #      include <uriparser/UriDefsAnsi.h>
@@ -82,29 +82,27 @@ int URI_FUNC(FreeUriPath)(URI_TYPE(Uri) * uri, UriMemoryManager * memory);
 bool URI_FUNC(RangeEquals)(const URI_TYPE(TextRange) * a, const URI_TYPE(TextRange) * b);

 UriBool URI_FUNC(CopyRange)(URI_TYPE(TextRange) * destRange,
-                            const URI_TYPE(TextRange) * sourceRange,
-                            UriMemoryManager * memory);
+        const URI_TYPE(TextRange) * sourceRange, UriMemoryManager * memory);
 UriBool URI_FUNC(CopyRangeAsNeeded)(URI_TYPE(TextRange) * destRange,
-                                    const URI_TYPE(TextRange) * sourceRange,
-                                    UriMemoryManager * memory);
+        const URI_TYPE(TextRange) * sourceRange, UriMemoryManager * memory);

-UriBool URI_FUNC(RemoveDotSegmentsAbsolute)(URI_TYPE(Uri) * uri,
-                                            UriMemoryManager * memory);
+UriBool URI_FUNC(RemoveDotSegmentsAbsolute)(
+        URI_TYPE(Uri) * uri, UriMemoryManager * memory);
 UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri, UriBool relative,
-                                      UriBool pathOwned, UriMemoryManager * memory);
+        UriBool pathOwned, UriMemoryManager * memory);

 unsigned char URI_FUNC(HexdigToInt)(URI_CHAR hexdig);
 URI_CHAR URI_FUNC(HexToLetterEx)(unsigned int value, UriBool uppercase);

-UriBool URI_FUNC(CopyPath)(URI_TYPE(Uri) * dest, const URI_TYPE(Uri) * source,
-                           UriMemoryManager * memory);
-UriBool URI_FUNC(CopyAuthority)(URI_TYPE(Uri) * dest, const URI_TYPE(Uri) * source,
-                                UriMemoryManager * memory);
+UriBool URI_FUNC(CopyPath)(
+        URI_TYPE(Uri) * dest, const URI_TYPE(Uri) * source, UriMemoryManager * memory);
+UriBool URI_FUNC(CopyAuthority)(
+        URI_TYPE(Uri) * dest, const URI_TYPE(Uri) * source, UriMemoryManager * memory);

 UriBool URI_FUNC(FixAmbiguity)(URI_TYPE(Uri) * uri, UriMemoryManager * memory);
 UriBool URI_FUNC(FixPathNoScheme)(URI_TYPE(Uri) * uri, UriMemoryManager * memory);
-UriBool URI_FUNC(EnsureThatPathIsNotMistakenForHost)(URI_TYPE(Uri) * uri,
-                                                     UriMemoryManager * memory);
+UriBool URI_FUNC(EnsureThatPathIsNotMistakenForHost)(
+        URI_TYPE(Uri) * uri, UriMemoryManager * memory);
 void URI_FUNC(FixEmptyTrailSegment)(URI_TYPE(Uri) * uri, UriMemoryManager * memory);

 #  endif
diff --git a/ext/uri/uriparser/src/UriCompare.c b/ext/uri/uriparser/src/UriCompare.c
index f9def86f666..3fa953fe501 100644
--- a/ext/uri/uriparser/src/UriCompare.c
+++ b/ext/uri/uriparser/src/UriCompare.c
@@ -88,9 +88,9 @@ UriBool URI_FUNC(EqualsUri)(const URI_TYPE(Uri) * a, const URI_TYPE(Uri) * b) {

     /* Host */
     if (((a->hostData.ip4 == NULL) != (b->hostData.ip4 == NULL))
-        || ((a->hostData.ip6 == NULL) != (b->hostData.ip6 == NULL))
-        || ((a->hostData.ipFuture.first == NULL)
-            != (b->hostData.ipFuture.first == NULL))) {
+            || ((a->hostData.ip6 == NULL) != (b->hostData.ip6 == NULL))
+            || ((a->hostData.ipFuture.first == NULL)
+                    != (b->hostData.ipFuture.first == NULL))) {
         return URI_FALSE;
     }

@@ -113,7 +113,7 @@ UriBool URI_FUNC(EqualsUri)(const URI_TYPE(Uri) * a, const URI_TYPE(Uri) * b) {
     }

     if ((a->hostData.ip4 == NULL) && (a->hostData.ip6 == NULL)
-        && (a->hostData.ipFuture.first == NULL)) {
+            && (a->hostData.ipFuture.first == NULL)) {
         if (!URI_FUNC(RangeEquals)(&(a->hostText), &(b->hostText))) {
             return URI_FALSE;
         }
diff --git a/ext/uri/uriparser/src/UriCopy.c b/ext/uri/uriparser/src/UriCopy.c
index fbe6340faa4..9b2a76aa8f0 100644
--- a/ext/uri/uriparser/src/UriCopy.c
+++ b/ext/uri/uriparser/src/UriCopy.c
@@ -74,9 +74,8 @@
 #    include "UriCopy.h"
 #  endif

-static void URI_FUNC(PreventLeakageAfterCopy)(URI_TYPE(Uri) * uri,
-                                              unsigned int revertMask,
-                                              UriMemoryManager * memory) {
+static void URI_FUNC(PreventLeakageAfterCopy)(
+        URI_TYPE(Uri) * uri, unsigned int revertMask, UriMemoryManager * memory) {
     URI_FUNC(PreventLeakage)(uri, revertMask, memory);

     if (uri->hostData.ip4 != NULL) {
@@ -97,7 +96,7 @@ static void URI_FUNC(PreventLeakageAfterCopy)(URI_TYPE(Uri) * uri,
 }

 int URI_FUNC(CopyUriMm)(URI_TYPE(Uri) * destUri, const URI_TYPE(Uri) * sourceUri,
-                        UriMemoryManager * memory) {
+        UriMemoryManager * memory) {
     unsigned int revertMask = URI_NORMALIZED;

     if (sourceUri == NULL || destUri == NULL) {
@@ -109,14 +108,14 @@ int URI_FUNC(CopyUriMm)(URI_TYPE(Uri) * destUri, const URI_TYPE(Uri) * sourceUri
     URI_FUNC(ResetUri)(destUri);

     if (URI_FUNC(CopyRangeAsNeeded)(&destUri->scheme, &sourceUri->scheme, memory)
-        == URI_FALSE) {
+            == URI_FALSE) {
         return URI_ERROR_MALLOC;
     }

     revertMask |= URI_NORMALIZE_SCHEME;

     if (URI_FUNC(CopyRangeAsNeeded)(&destUri->userInfo, &sourceUri->userInfo, memory)
-        == URI_FALSE) {
+            == URI_FALSE) {
         URI_FUNC(PreventLeakageAfterCopy)(destUri, revertMask, memory);
         return URI_ERROR_MALLOC;
     }
@@ -124,7 +123,7 @@ int URI_FUNC(CopyUriMm)(URI_TYPE(Uri) * destUri, const URI_TYPE(Uri) * sourceUri
     revertMask |= URI_NORMALIZE_USER_INFO;

     if (URI_FUNC(CopyRangeAsNeeded)(&destUri->hostText, &sourceUri->hostText, memory)
-        == URI_FALSE) {
+            == URI_FALSE) {
         URI_FUNC(PreventLeakageAfterCopy)(destUri, revertMask, memory);
         return URI_ERROR_MALLOC;
     }
@@ -156,15 +155,15 @@ int URI_FUNC(CopyUriMm)(URI_TYPE(Uri) * destUri, const URI_TYPE(Uri) * sourceUri
     if (sourceUri->hostData.ipFuture.first != NULL) {
         destUri->hostData.ipFuture.first = destUri->hostText.first;
         destUri->hostData.ipFuture.afterLast = destUri->hostText.afterLast;
-    } else if (URI_FUNC(CopyRangeAsNeeded)(&destUri->hostData.ipFuture,
-                                           &sourceUri->hostData.ipFuture, memory)
+    } else if (URI_FUNC(CopyRangeAsNeeded)(
+                       &destUri->hostData.ipFuture, &sourceUri->hostData.ipFuture, memory)
                == URI_FALSE) {
         URI_FUNC(PreventLeakageAfterCopy)(destUri, revertMask, memory);
         return URI_ERROR_MALLOC;
     }

     if (URI_FUNC(CopyRangeAsNeeded)(&destUri->portText, &sourceUri->portText, memory)
-        == URI_FALSE) {
+            == URI_FALSE) {
         URI_FUNC(PreventLeakageAfterCopy)(destUri, revertMask, memory);
         return URI_ERROR_MALLOC;
     }
@@ -180,7 +179,7 @@ int URI_FUNC(CopyUriMm)(URI_TYPE(Uri) * destUri, const URI_TYPE(Uri) * sourceUri

         while (sourceWalker != NULL) {
             URI_TYPE(PathSegment) * destWalker =
-                memory->malloc(memory, sizeof(URI_TYPE(PathSegment)));
+                    memory->malloc(memory, sizeof(URI_TYPE(PathSegment)));
             if (destWalker == NULL) {
                 URI_FUNC(PreventLeakageAfterCopy)(destUri, revertMask, memory);
                 return URI_ERROR_MALLOC;
@@ -196,9 +195,9 @@ int URI_FUNC(CopyUriMm)(URI_TYPE(Uri) * destUri, const URI_TYPE(Uri) * sourceUri
                 revertMask |= URI_NORMALIZE_PATH;
             }

-            if (URI_FUNC(CopyRangeAsNeeded)(&destWalker->text, &sourceWalker->text,
-                                            memory)
-                == URI_FALSE) {
+            if (URI_FUNC(CopyRangeAsNeeded)(
+                        &destWalker->text, &sourceWalker->text, memory)
+                    == URI_FALSE) {
                 // Unless wired to `destUri` above, `destWalker` may be hanging
                 // in the air now
                 if (destUri->pathHead != destWalker) {
@@ -221,7 +220,7 @@ int URI_FUNC(CopyUriMm)(URI_TYPE(Uri) * destUri, const URI_TYPE(Uri) * sourceUri
     }

     if (URI_FUNC(CopyRangeAsNeeded)(&destUri->query, &sourceUri->query, memory)
-        == URI_FALSE) {
+            == URI_FALSE) {
         URI_FUNC(PreventLeakageAfterCopy)(destUri, revertMask, memory);
         return URI_ERROR_MALLOC;
     }
@@ -229,7 +228,7 @@ int URI_FUNC(CopyUriMm)(URI_TYPE(Uri) * destUri, const URI_TYPE(Uri) * sourceUri
     revertMask |= URI_NORMALIZE_QUERY;

     if (URI_FUNC(CopyRangeAsNeeded)(&destUri->fragment, &sourceUri->fragment, memory)
-        == URI_FALSE) {
+            == URI_FALSE) {
         URI_FUNC(PreventLeakageAfterCopy)(destUri, revertMask, memory);
         return URI_ERROR_MALLOC;
     }
diff --git a/ext/uri/uriparser/src/UriCopy.h b/ext/uri/uriparser/src/UriCopy.h
index 430f5dc6da2..dd2912c775d 100644
--- a/ext/uri/uriparser/src/UriCopy.h
+++ b/ext/uri/uriparser/src/UriCopy.h
@@ -39,8 +39,8 @@
  */

 #if (defined(URI_PASS_ANSI) && !defined(URI_COPY_H_ANSI)) \
-    || (defined(URI_PASS_UNICODE) && !defined(URI_COPY_H_UNICODE)) \
-    || (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
+        || (defined(URI_PASS_UNICODE) && !defined(URI_COPY_H_UNICODE)) \
+        || (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
 /* What encodings are enabled? */
 #  include <uriparser/UriDefsConfig.h>
 #  if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
@@ -57,9 +57,9 @@
 #    endif
 /* Only one pass for each encoding */
 #  elif (defined(URI_PASS_ANSI) && !defined(URI_COPY_H_ANSI) \
-         && defined(URI_ENABLE_ANSI)) \
-      || (defined(URI_PASS_UNICODE) && !defined(URI_COPY_H_UNICODE) \
-          && defined(URI_ENABLE_UNICODE))
+          && defined(URI_ENABLE_ANSI)) \
+          || (defined(URI_PASS_UNICODE) && !defined(URI_COPY_H_UNICODE) \
+                  && defined(URI_ENABLE_UNICODE))
 #    ifdef URI_PASS_ANSI
 #      define URI_COPY_H_ANSI 1
 #      include <uriparser/UriDefsAnsi.h>
@@ -69,7 +69,7 @@
 #    endif

 int URI_FUNC(CopyUriMm)(URI_TYPE(Uri) * destUri, const URI_TYPE(Uri) * sourceUri,
-                        UriMemoryManager * memory);
+        UriMemoryManager * memory);
 int URI_FUNC(CopyUri)(URI_TYPE(Uri) * destUri, const URI_TYPE(Uri) * sourceUri);

 #  endif
diff --git a/ext/uri/uriparser/src/UriEscape.c b/ext/uri/uriparser/src/UriEscape.c
index a1763f97153..a3b9e848a8f 100644
--- a/ext/uri/uriparser/src/UriEscape.c
+++ b/ext/uri/uriparser/src/UriEscape.c
@@ -66,13 +66,12 @@
 #  endif

 URI_CHAR * URI_FUNC(Escape)(const URI_CHAR * in, URI_CHAR * out, UriBool spaceToPlus,
-                            UriBool normalizeBreaks) {
+        UriBool normalizeBreaks) {
     return URI_FUNC(EscapeEx)(in, NULL, out, spaceToPlus, normalizeBreaks);
 }

 URI_CHAR * URI_FUNC(EscapeEx)(const URI_CHAR * inFirst, const URI_CHAR * inAfterLast,
-                              URI_CHAR * out, UriBool spaceToPlus,
-                              UriBool normalizeBreaks) {
+        URI_CHAR * out, UriBool spaceToPlus, UriBool normalizeBreaks) {
     const URI_CHAR * read = inFirst;
     URI_CHAR * write = out;
     UriBool prevWasCr = URI_FALSE;
@@ -179,8 +178,8 @@ const URI_CHAR * URI_FUNC(UnescapeInPlace)(URI_CHAR * inout) {
     return URI_FUNC(UnescapeInPlaceEx)(inout, URI_FALSE, URI_BR_DONT_TOUCH);
 }

-const URI_CHAR * URI_FUNC(UnescapeInPlaceEx)(URI_CHAR * inout, UriBool plusToSpace,
-                                             UriBreakConversion breakConversion) {
+const URI_CHAR * URI_FUNC(UnescapeInPlaceEx)(
+        URI_CHAR * inout, UriBool plusToSpace, UriBreakConversion breakConversion) {
     URI_CHAR * read = inout;
     URI_CHAR * write = inout;
     UriBool prevWasCr = URI_FALSE;
diff --git a/ext/uri/uriparser/src/UriFile.c b/ext/uri/uriparser/src/UriFile.c
index 0af88480b0a..3bcedfe07a0 100644
--- a/ext/uri/uriparser/src/UriFile.c
+++ b/ext/uri/uriparser/src/UriFile.c
@@ -66,11 +66,10 @@
 #  include <stddef.h>  // size_t
 #  include <stdint.h>  // SIZE_MAX

-static URI_INLINE int URI_FUNC(FilenameToUriString)(const URI_CHAR * filename,
-                                                    URI_CHAR * uriString,
-                                                    UriBool fromUnix) {
+static URI_INLINE int URI_FUNC(FilenameToUriString)(
+        const URI_CHAR * filename, URI_CHAR * uriString, UriBool fromUnix) {
     const URI_CHAR * input = filename;
-    const URI_CHAR * lastSep = input - 1;
+    const URI_CHAR * afterLastSep = input;
     UriBool firstSegment = URI_TRUE;
     URI_CHAR * output = uriString;
     UriBool absolute;
@@ -83,7 +82,7 @@ static URI_INLINE int URI_FUNC(FilenameToUriString)(const URI_CHAR * filename,
     is_windows_network = (filename[0] == _UT('\\')) && (filename[1] == _UT('\\'));
     absolute = fromUnix ? (filename[0] == _UT('/'))
                         : (((filename[0] != _UT('\0')) && (filename[1] == _UT(':')))
-                           || is_windows_network);
+                                  || is_windows_network);

     if (absolute) {
         const URI_CHAR * const prefix = fromUnix             ? _UT("file://")
@@ -104,23 +103,23 @@ static URI_INLINE int URI_FUNC(FilenameToUriString)(const URI_CHAR * filename,
     /* Copy and escape on the fly */
     for (;;) {
         if ((input[0] == _UT('\0')) || (fromUnix && input[0] == _UT('/'))
-            || (!fromUnix && input[0] == _UT('\\'))) {
+                || (!fromUnix && input[0] == _UT('\\'))) {
             /* Copy text after last separator */
-            if (lastSep + 1 < input) {
+            if (afterLastSep < input) {
                 if (!fromUnix && absolute && (firstSegment == URI_TRUE)) {
                     /* Quick hack to not convert "C:" to "C%3A" */
-                    const size_t charsToCopy = input - (lastSep + 1);
+                    const size_t charsToCopy = input - afterLastSep;

                     // Detect and avoid integer overflow
                     if (charsToCopy > SIZE_MAX / sizeof(URI_CHAR)) {
                         return URI_ERROR_OUTPUT_TOO_LARGE;
                     }

-                    memcpy(output, lastSep + 1, charsToCopy * sizeof(URI_CHAR));
+                    memcpy(output, afterLastSep, charsToCopy * sizeof(URI_CHAR));
                     output += charsToCopy;
                 } else {
-                    output = URI_FUNC(EscapeEx)(lastSep + 1, input, output, URI_FALSE,
-                                                URI_FALSE);
+                    output = URI_FUNC(EscapeEx)(
+                            afterLastSep, input, output, URI_FALSE, URI_FALSE);
                 }
             }
             firstSegment = URI_FALSE;
@@ -133,12 +132,12 @@ static URI_INLINE int URI_FUNC(FilenameToUriString)(const URI_CHAR * filename,
             /* Copy separators unmodified */
             output[0] = _UT('/');
             output++;
-            lastSep = input;
+            afterLastSep = input + 1;
         } else if (!fromUnix && (input[0] == _UT('\\'))) {
             /* Convert backslashes to forward slashes */
             output[0] = _UT('/');
             output++;
-            lastSep = input;
+            afterLastSep = input + 1;
         }
         input++;
     }
@@ -146,49 +145,54 @@ static URI_INLINE int URI_FUNC(FilenameToUriString)(const URI_CHAR * filename,
     return URI_SUCCESS;
 }

-static URI_INLINE int URI_FUNC(UriStringToFilename)(const URI_CHAR * uriString,
-                                                    URI_CHAR * filename, UriBool toUnix) {
+static URI_INLINE int URI_FUNC(UriStringToFilename)(
+        const URI_CHAR * uriString, URI_CHAR * filename, UriBool toUnix) {
     if ((uriString == NULL) || (filename == NULL)) {
         return URI_ERROR_NULL;
     }

     const UriBool file_unknown_slashes =
-        URI_STRNCMP(uriString, _UT("file:"), URI_STRLEN(_UT("file:"))) == 0;
+            URI_STRNCMP(uriString, _UT("file:"), URI_STRLEN(_UT("file:"))) == 0;
     const UriBool file_one_or_more_slashes =
-        file_unknown_slashes
-        && (URI_STRNCMP(uriString, _UT("file:/"), URI_STRLEN(_UT("file:/"))) == 0);
+            file_unknown_slashes
+            && (URI_STRNCMP(uriString, _UT("file:/"), URI_STRLEN(_UT("file:/"))) == 0);
     const UriBool file_two_or_more_slashes =
-        file_one_or_more_slashes
-        && (URI_STRNCMP(uriString, _UT("file://"), URI_STRLEN(_UT("file://"))) == 0);
+            file_one_or_more_slashes
+            && (URI_STRNCMP(uriString, _UT("file://"), URI_STRLEN(_UT("file://"))) == 0);
     const UriBool file_three_or_more_slashes =
-        file_two_or_more_slashes
-        && (URI_STRNCMP(uriString, _UT("file:///"), URI_STRLEN(_UT("file:///"))) == 0);
+            file_two_or_more_slashes
+            && (URI_STRNCMP(uriString, _UT("file:///"), URI_STRLEN(_UT("file:///")))
+                    == 0);

     const size_t charsToSkip =
-        file_two_or_more_slashes
-            ? file_three_or_more_slashes ? toUnix
-                                               /* file:///bin/bash */
-                                               ? URI_STRLEN(_UT("file://"))
-                                               /* file:///E:/Documents%20and%20Settings */
-                                               : URI_STRLEN(_UT("file:///"))
-                                         /* file://Server01/Letter.txt */
-                                         : URI_STRLEN(_UT("file://"))
-            : ((file_one_or_more_slashes && toUnix)
-                   /* file:/bin/bash */
-                   /* https://tools.ietf.org/html/rfc8089#appendix-B */
-                   ? URI_STRLEN(_UT("file:"))
-                   : ((!toUnix && file_unknown_slashes && !file_one_or_more_slashes)
-                          /* file:c:/path/to/file */
-                          /* https://tools.ietf.org/html/rfc8089#appendix-E.2 */
-                          ? URI_STRLEN(_UT("file:"))
-                          : 0));
+            file_two_or_more_slashes
+                    ? file_three_or_more_slashes
+                              ? toUnix
+                                        /* file:///bin/bash */
+                                        ? URI_STRLEN(_UT("file://"))
+                                        /* file:///E:/Documents%20and%20Settings */
+                                        : URI_STRLEN(_UT("file:///"))
+                              /* file://Server01/Letter.txt */
+                              : URI_STRLEN(_UT("file://"))
+                    : ((file_one_or_more_slashes && toUnix)
+                                      /* file:/bin/bash */
+                                      /* https://tools.ietf.org/html/rfc8089#appendix-B */
+                                      ? URI_STRLEN(_UT("file:"))
+                                      : ((!toUnix && file_unknown_slashes
+                                                 && !file_one_or_more_slashes)
+                                                        /* file:c:/path/to/file */
+                                                        /* https://tools.ietf.org/html/rfc8089#appendix-E.2
+                                                         */
+                                                        ? URI_STRLEN(_UT("file:"))
+                                                        : 0));
     const size_t charsToCopy = URI_STRLEN(uriString + charsToSkip) + 1;

-    const UriBool is_windows_network_with_authority =
-        (toUnix == URI_FALSE) && file_two_or_more_slashes && !file_three_or_more_slashes;
+    const UriBool is_windows_network_with_authority = (toUnix == URI_FALSE)
+                                                      && file_two_or_more_slashes
+                                                      && !file_three_or_more_slashes;

     URI_CHAR * const unescape_target =
-        is_windows_network_with_authority ? (filename + 2) : filename;
+            is_windows_network_with_authority ? (filename + 2) : filename;

     if (is_windows_network_with_authority) {
         filename[0] = '\\';
@@ -216,8 +220,8 @@ int URI_FUNC(UnixFilenameToUriString)(const URI_CHAR * filename, URI_CHAR * uriS
     return URI_FUNC(FilenameToUriString)(filename, uriString, URI_TRUE);
 }

-int URI_FUNC(WindowsFilenameToUriString)(const URI_CHAR * filename,
-                                         URI_CHAR * uriString) {
+int URI_FUNC(WindowsFilenameToUriString)(
+        const URI_CHAR * filename, URI_CHAR * uriString) {
     return URI_FUNC(FilenameToUriString)(filename, uriString, URI_FALSE);
 }

@@ -225,8 +229,8 @@ int URI_FUNC(UriStringToUnixFilename)(const URI_CHAR * uriString, URI_CHAR * fil
     return URI_FUNC(UriStringToFilename)(uriString, filename, URI_TRUE);
 }

-int URI_FUNC(UriStringToWindowsFilename)(const URI_CHAR * uriString,
-                                         URI_CHAR * filename) {
+int URI_FUNC(UriStringToWindowsFilename)(
+        const URI_CHAR * uriString, URI_CHAR * filename) {
     return URI_FUNC(UriStringToFilename)(uriString, filename, URI_FALSE);
 }

diff --git a/ext/uri/uriparser/src/UriIp4.c b/ext/uri/uriparser/src/UriIp4.c
index ae61141f7a3..ad404af0fe6 100644
--- a/ext/uri/uriparser/src/UriIp4.c
+++ b/ext/uri/uriparser/src/UriIp4.c
@@ -72,27 +72,22 @@
 #  endif

 /* Prototypes */
-static const URI_CHAR * URI_FUNC(ParseDecOctet)(UriIp4Parser * parser,
-                                                const URI_CHAR * first,
-                                                const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseDecOctetOne)(UriIp4Parser * parser,
-                                                   const URI_CHAR * first,
-                                                   const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseDecOctetTwo)(UriIp4Parser * parser,
-                                                   const URI_CHAR * first,
-                                                   const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseDecOctetThree)(UriIp4Parser * parser,
-                                                     const URI_CHAR * first,
-                                                     const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseDecOctetFour)(UriIp4Parser * parser,
-                                                    const URI_CHAR * first,
-                                                    const URI_CHAR * afterLast);
+static const URI_CHAR * URI_FUNC(ParseDecOctet)(
+        UriIp4Parser * parser, const URI_CHAR * first, const URI_CHAR * afterLast);
+static const URI_CHAR * URI_FUNC(ParseDecOctetOne)(
+        UriIp4Parser * parser, const URI_CHAR * first, const URI_CHAR * afterLast);
+static const URI_CHAR * URI_FUNC(ParseDecOctetTwo)(
+        UriIp4Parser * parser, const URI_CHAR * first, const URI_CHAR * afterLast);
+static const URI_CHAR * URI_FUNC(ParseDecOctetThree)(
+        UriIp4Parser * parser, const URI_CHAR * first, const URI_CHAR * afterLast);
+static const URI_CHAR * URI_FUNC(ParseDecOctetFour)(
+        UriIp4Parser * parser, const URI_CHAR * first, const URI_CHAR * afterLast);

 /*
  * [ipFourAddress]->[decOctet]<.>[decOctet]<.>[decOctet]<.>[decOctet]
  */
-int URI_FUNC(ParseIpFourAddress)(unsigned char * octetOutput, const URI_CHAR * first,
-                                 const URI_CHAR * afterLast) {
+int URI_FUNC(ParseIpFourAddress)(
+        unsigned char * octetOutput, const URI_CHAR * first, const URI_CHAR * afterLast) {
     const URI_CHAR * after;
     UriIp4Parser parser;

@@ -147,9 +142,8 @@ int URI_FUNC(ParseIpFourAddress)(unsigned char * octetOutput, const URI_CHAR * f
  * [decOctet]-><8>[decOctetThree]
  * [decOctet]-><9>[decOctetThree]
  */
-static URI_INLINE const URI_CHAR * URI_FUNC(ParseDecOctet)(UriIp4Parser * parser,
-                                                           const URI_CHAR * first,
-                                                           const URI_CHAR * afterLast) {
+static URI_INLINE const URI_CHAR * URI_FUNC(ParseDecOctet)(
+        UriIp4Parser * parser, const URI_CHAR * first, const URI_CHAR * afterLast) {
     if (first >= afterLast) {
         return NULL;
     }
@@ -175,8 +169,8 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseDecOctet)(UriIp4Parser * parser
     case _UT('8'):
     case _UT('9'):
         uriPushToStack(parser, (unsigned char)(9 + *first - _UT('9')));
-        return (const URI_CHAR *)URI_FUNC(ParseDecOctetThree)(parser, first + 1,
-                                                              afterLast);
+        return (const URI_CHAR *)URI_FUNC(ParseDecOctetThree)(
+                parser, first + 1, afterLast);

     default:
         return NULL;
@@ -187,9 +181,8 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseDecOctet)(UriIp4Parser * parser
  * [decOctetOne]-><NULL>
  * [decOctetOne]->[DIGIT][decOctetThree]
  */
-static URI_INLINE const URI_CHAR *
-URI_FUNC(ParseDecOctetOne)(UriIp4Parser * parser, const URI_CHAR * first,
-                           const URI_CHAR * afterLast) {
+static URI_INLINE const URI_CHAR * URI_FUNC(ParseDecOctetOne)(
+        UriIp4Parser * parser, const URI_CHAR * first, const URI_CHAR * afterLast) {
     if (first >= afterLast) {
         return afterLast;
     }
@@ -197,8 +190,8 @@ URI_FUNC(ParseDecOctetOne)(UriIp4Parser * parser, const URI_CHAR * first,
     switch (*first) {
     case URI_SET_DIGIT(_UT):
         uriPushToStack(parser, (unsigned char)(9 + *first - _UT('9')));
-        return (const URI_CHAR *)URI_FUNC(ParseDecOctetThree)(parser, first + 1,
-                                                              afterLast);
+        return (const URI_CHAR *)URI_FUNC(ParseDecOctetThree)(
+                parser, first + 1, afterLast);

     default:
         return first;
@@ -218,9 +211,8 @@ URI_FUNC(ParseDecOctetOne)(UriIp4Parser * parser, const URI_CHAR * first,
  * [decOctetTwo]-><8>
  * [decOctetTwo]-><9>
  */
-static URI_INLINE const URI_CHAR *
-URI_FUNC(ParseDecOctetTwo)(UriIp4Parser * parser, const URI_CHAR * first,
-                           const URI_CHAR * afterLast) {
+static URI_INLINE const URI_CHAR * URI_FUNC(ParseDecOctetTwo)(
+        UriIp4Parser * parser, const URI_CHAR * first, const URI_CHAR * afterLast) {
     if (first >= afterLast) {
         return afterLast;
     }
@@ -232,13 +224,13 @@ URI_FUNC(ParseDecOctetTwo)(UriIp4Parser * parser, const URI_CHAR * first,
     case _UT('3'):
     case _UT('4'):
         uriPushToStack(parser, (unsigned char)(9 + *first - _UT('9')));
-        return (const URI_CHAR *)URI_FUNC(ParseDecOctetThree)(parser, first + 1,
-                                                              afterLast);
+        return (const URI_CHAR *)URI_FUNC(ParseDecOctetThree)(
+                parser, first + 1, afterLast);

     case _UT('5'):
         uriPushToStack(parser, 5);
-        return (const URI_CHAR *)URI_FUNC(ParseDecOctetFour)(parser, first + 1,
-                                                             afterLast);
+        return (const URI_CHAR *)URI_FUNC(ParseDecOctetFour)(
+                parser, first + 1, afterLast);

     case _UT('6'):
     case _UT('7'):
@@ -256,9 +248,8 @@ URI_FUNC(ParseDecOctetTwo)(UriIp4Parser * parser, const URI_CHAR * first,
  * [decOctetThree]-><NULL>
  * [decOctetThree]->[DIGIT]
  */
-static URI_INLINE const URI_CHAR *
-URI_FUNC(ParseDecOctetThree)(UriIp4Parser * parser, const URI_CHAR * first,
-                             const URI_CHAR * afterLast) {
+static URI_INLINE const URI_CHAR * URI_FUNC(ParseDecOctetThree)(
+        UriIp4Parser * parser, const URI_CHAR * first, const URI_CHAR * afterLast) {
     if (first >= afterLast) {
         return afterLast;
     }
@@ -282,9 +273,8 @@ URI_FUNC(ParseDecOctetThree)(UriIp4Parser * parser, const URI_CHAR * first,
  * [decOctetFour]-><4>
  * [decOctetFour]-><5>
  */
-static URI_INLINE const URI_CHAR *
-URI_FUNC(ParseDecOctetFour)(UriIp4Parser * parser, const URI_CHAR * first,
-                            const URI_CHAR * afterLast) {
+static URI_INLINE const URI_CHAR * URI_FUNC(ParseDecOctetFour)(
+        UriIp4Parser * parser, const URI_CHAR * first, const URI_CHAR * afterLast) {
     if (first >= afterLast) {
         return afterLast;
     }
diff --git a/ext/uri/uriparser/src/UriMemory.c b/ext/uri/uriparser/src/UriMemory.c
index 669f48dd682..ec3202d5deb 100644
--- a/ext/uri/uriparser/src/UriMemory.c
+++ b/ext/uri/uriparser/src/UriMemory.c
@@ -44,12 +44,19 @@

 #include "UriConfig.h" /* for HAVE_REALLOCARRAY */

+// NOTE: Please keep this block in sync with its sibling in file
+//       `CMakeLists.txt`!
 #ifdef HAVE_REALLOCARRAY
 // For glibc >=2.29 of 2019-02-01
 #  if !defined(_DEFAULT_SOURCE)
 #    define _DEFAULT_SOURCE 1
 #  endif

+// For glibc <2.29
+#  if !defined(_GNU_SOURCE)
+#    define _GNU_SOURCE 1
+#  endif
+
 // For NetBSD (stdlib.h revision 1.122 of 2020-05-26)
 #  if defined(__NetBSD__) && !defined(_OPENBSD_SOURCE)
 #    define _OPENBSD_SOURCE 1
@@ -93,18 +100,18 @@ static void * uriDefaultMalloc(UriMemoryManager * URI_UNUSED(memory), size_t siz
     return malloc(size);
 }

-static void * uriDefaultCalloc(UriMemoryManager * URI_UNUSED(memory), size_t nmemb,
-                               size_t size) {
+static void * uriDefaultCalloc(
+        UriMemoryManager * URI_UNUSED(memory), size_t nmemb, size_t size) {
     return calloc(nmemb, size);
 }

-static void * uriDefaultRealloc(UriMemoryManager * URI_UNUSED(memory), void * ptr,
-                                size_t size) {
+static void * uriDefaultRealloc(
+        UriMemoryManager * URI_UNUSED(memory), void * ptr, size_t size) {
     return realloc(ptr, size);
 }

-static void * uriDefaultReallocarray(UriMemoryManager * URI_UNUSED(memory), void * ptr,
-                                     size_t nmemb, size_t size) {
+static void * uriDefaultReallocarray(
+        UriMemoryManager * URI_UNUSED(memory), void * ptr, size_t nmemb, size_t size) {
 #ifdef HAVE_REALLOCARRAY
     return reallocarray(ptr, nmemb, size);
 #else
@@ -122,9 +129,9 @@ static void uriDefaultFree(UriMemoryManager * URI_UNUSED(memory), void * ptr) {

 UriBool uriMemoryManagerIsComplete(const UriMemoryManager * memory) {
     return (memory && memory->malloc && memory->calloc && memory->realloc
-            && memory->reallocarray && memory->free)
-               ? URI_TRUE
-               : URI_FALSE;
+                   && memory->reallocarray && memory->free)
+                   ? URI_TRUE
+                   : URI_FALSE;
 }

 void * uriEmulateCalloc(UriMemoryManager * memory, size_t nmemb, size_t size) {
@@ -147,8 +154,8 @@ void * uriEmulateCalloc(UriMemoryManager * memory, size_t nmemb, size_t size) {
     return buffer;
 }

-void * uriEmulateReallocarray(UriMemoryManager * memory, void * ptr, size_t nmemb,
-                              size_t size) {
+void * uriEmulateReallocarray(
+        UriMemoryManager * memory, void * ptr, size_t nmemb, size_t size) {
     const size_t total_size = nmemb * size;

     if (memory == NULL) {
@@ -309,6 +316,7 @@ int uriTestMemoryManagerEx(UriMemoryManager * memory, UriBool challengeAlignment
     }
     for (index = 0; index < callocTotalSize; index++) { /* all zeros? */
         if (buffer[index] != '\0') {
+            memory->free(memory, buffer);
             return URI_ERROR_MEMORY_MANAGER_FAULTY;
         }
     }
@@ -324,12 +332,15 @@ int uriTestMemoryManagerEx(UriMemoryManager * memory, UriBool challengeAlignment
     for (index = 0; index < mallocSize; index++) {
         buffer[index] = '\xF3';
     }
-    buffer = memory->realloc(memory, buffer, reallocSize);
-    if (buffer == NULL) {
+    void * const reallocBuffer = memory->realloc(memory, buffer, reallocSize);
+    if (reallocBuffer == NULL) {
+        memory->free(memory, buffer);
         return URI_ERROR_MEMORY_MANAGER_FAULTY;
     }
+    buffer = reallocBuffer;
     for (index = 0; index < mallocSize; index++) { /* previous content? */
         if (buffer[index] != '\xF3') {
+            memory->free(memory, buffer);
             return URI_ERROR_MEMORY_MANAGER_FAULTY;
         }
     }
@@ -370,12 +381,16 @@ int uriTestMemoryManagerEx(UriMemoryManager * memory, UriBool challengeAlignment
     for (index = 0; index < mallocSize; index++) {
         buffer[index] = '\xF7';
     }
-    buffer = memory->reallocarray(memory, buffer, reallocarrayNmemb, reallocarraySize);
-    if (buffer == NULL) {
+    void * const reallocarrayBuffer =
+            memory->reallocarray(memory, buffer, reallocarrayNmemb, reallocarraySize);
+    if (reallocarrayBuffer == NULL) {
+        memory->free(memory, buffer);
         return URI_ERROR_MEMORY_MANAGER_FAULTY;
     }
+    buffer = reallocarrayBuffer;
     for (index = 0; index < mallocSize; index++) { /* previous content? */
         if (buffer[index] != '\xF7') {
+            memory->free(memory, buffer);
             return URI_ERROR_MEMORY_MANAGER_FAULTY;
         }
     }
@@ -450,7 +465,7 @@ int uriTestMemoryManagerEx(UriMemoryManager * memory, UriBool challengeAlignment
             ptr[3] = 3.3L;

             long double * const ptrNew =
-                memory->realloc(memory, ptr, 8 * sizeof(long double));
+                    memory->realloc(memory, ptr, 8 * sizeof(long double));
             if (ptrNew != NULL) {
                 ptr = ptrNew;
                 ptr[4] = 4.4L;
@@ -472,6 +487,6 @@ int uriTestMemoryManager(UriMemoryManager * memory) {
 }

 /*extern*/ UriMemoryManager defaultMemoryManager = {
-    uriDefaultMalloc,       uriDefaultCalloc, uriDefaultRealloc,
-    uriDefaultReallocarray, uriDefaultFree,   NULL /* userData */
+        uriDefaultMalloc, uriDefaultCalloc, uriDefaultRealloc, uriDefaultReallocarray,
+        uriDefaultFree, NULL /* userData */
 };
diff --git a/ext/uri/uriparser/src/UriNormalize.c b/ext/uri/uriparser/src/UriNormalize.c
index c73e22b2887..71aea31ab33 100644
--- a/ext/uri/uriparser/src/UriNormalize.c
+++ b/ext/uri/uriparser/src/UriNormalize.c
@@ -76,40 +76,35 @@
 #  include <stdint.h>  // SIZE_MAX

 static int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri, unsigned int inMask,
-                                           unsigned int * outMask,
-                                           UriMemoryManager * memory);
+        unsigned int * outMask, UriMemoryManager * memory);

 static UriBool URI_FUNC(MakeRangeOwner)(unsigned int * revertMask, unsigned int maskTest,
-                                        URI_TYPE(TextRange) * range,
-                                        UriMemoryManager * memory);
-static UriBool URI_FUNC(MakeOwnerEngine)(URI_TYPE(Uri) * uri, unsigned int * revertMask,
-                                         UriMemoryManager * memory);
-
-static void URI_FUNC(FixPercentEncodingInplace)(const URI_CHAR * first,
-                                                const URI_CHAR ** afterLast);
-static UriBool URI_FUNC(FixPercentEncodingMalloc)(const URI_CHAR ** first,
-                                                  const URI_CHAR ** afterLast,
-                                                  UriMemoryManager * memory);
+        URI_TYPE(TextRange) * range, UriMemoryManager * memory);
+static UriBool URI_FUNC(MakeOwnerEngine)(
+        URI_TYPE(Uri) * uri, unsigned int * revertMask, UriMemoryManager * memory);
+
+static void URI_FUNC(FixPercentEncodingInplace)(
+        const URI_CHAR * first, const URI_CHAR ** afterLast);
+static UriBool URI_FUNC(FixPercentEncodingMalloc)(
+        const URI_CHAR ** first, const URI_CHAR ** afterLast, UriMemoryManager * memory);
 static void URI_FUNC(FixPercentEncodingEngine)(const URI_CHAR * inFirst,
-                                               const URI_CHAR * inAfterLast,
-                                               const URI_CHAR * outFirst,
-                                               const URI_CHAR ** outAfterLast);
-
-static UriBool URI_FUNC(ContainsUppercaseLetters)(const URI_CHAR * first,
-                                                  const URI_CHAR * afterLast);
-static UriBool URI_FUNC(ContainsUglyPercentEncoding)(const URI_CHAR * first,
-                                                     const URI_CHAR * afterLast);
-
-static void URI_FUNC(LowercaseInplace)(const URI_CHAR * first,
-                                       const URI_CHAR * afterLast);
-static void URI_FUNC(LowercaseInplaceExceptPercentEncoding)(const URI_CHAR * first,
-                                                            const URI_CHAR * afterLast);
-static UriBool URI_FUNC(LowercaseMalloc)(const URI_CHAR ** first,
-                                         const URI_CHAR ** afterLast,
-                                         UriMemoryManager * memory);
-
-void URI_FUNC(PreventLeakage)(URI_TYPE(Uri) * uri, unsigned int revertMask,
-                              UriMemoryManager * memory) {
+        const URI_CHAR * inAfterLast, const URI_CHAR * outFirst,
+        const URI_CHAR ** outAfterLast);
+
+static UriBool URI_FUNC(ContainsUppercaseLetters)(
+        const URI_CHAR * first, const URI_CHAR * afterLast);
+static UriBool URI_FUNC(ContainsUglyPercentEncoding)(
+        const URI_CHAR * first, const URI_CHAR * afterLast);
+
+static void URI_FUNC(LowercaseInplace)(
+        const URI_CHAR * first, const URI_CHAR * afterLast);
+static void URI_FUNC(LowercaseInplaceExceptPercentEncoding)(
+        const URI_CHAR * first, const URI_CHAR * afterLast);
+static UriBool URI_FUNC(LowercaseMalloc)(
+        const URI_CHAR ** first, const URI_CHAR ** afterLast, UriMemoryManager * memory);
+
+void URI_FUNC(PreventLeakage)(
+        URI_TYPE(Uri) * uri, unsigned int revertMask, UriMemoryManager * memory) {
     if (revertMask & URI_NORMALIZE_SCHEME) {
         /* NOTE: A scheme cannot be the empty string
          *       so no need to compare .first with .afterLast, here. */
@@ -179,8 +174,8 @@ void URI_FUNC(PreventLeakage)(URI_TYPE(Uri) * uri, unsigned int revertMask,
     }
 }

-static URI_INLINE UriBool URI_FUNC(ContainsUppercaseLetters)(const URI_CHAR * first,
-                                                             const URI_CHAR * afterLast) {
+static URI_INLINE UriBool URI_FUNC(ContainsUppercaseLetters)(
+        const URI_CHAR * first, const URI_CHAR * afterLast) {
     if ((first != NULL) && (afterLast != NULL) && (afterLast > first)) {
         const URI_CHAR * i = first;
         for (; i < afterLast; i++) {
@@ -194,7 +189,7 @@ static URI_INLINE UriBool URI_FUNC(ContainsUppercaseLetters)(const URI_CHAR * fi
 }

 static URI_INLINE UriBool URI_FUNC(ContainsUglyPercentEncoding)(
-    const URI_CHAR * first, const URI_CHAR * afterLast) {
+        const URI_CHAR * first, const URI_CHAR * afterLast) {
     if ((first != NULL) && (afterLast != NULL) && (afterLast > first)) {
         const URI_CHAR * i = first;
         for (; i + 2 < afterLast; i++) {
@@ -202,7 +197,7 @@ static URI_INLINE UriBool URI_FUNC(ContainsUglyPercentEncoding)(
                 /* 6.2.2.1 Case Normalization: *
                  * lowercase percent-encodings */
                 if (((i[1] >= _UT('a')) && (i[1] <= _UT('f')))
-                    || ((i[2] >= _UT('a')) && (i[2] <= _UT('f')))) {
+                        || ((i[2] >= _UT('a')) && (i[2] <= _UT('f')))) {
                     return URI_TRUE;
                 } else {
                     /* 6.2.2.2 Percent-Encoding Normalization: *
@@ -220,8 +215,8 @@ static URI_INLINE UriBool URI_FUNC(ContainsUglyPercentEncoding)(
     return URI_FALSE;
 }

-static URI_INLINE void URI_FUNC(LowercaseInplace)(const URI_CHAR * first,
-                                                  const URI_CHAR * afterLast) {
+static URI_INLINE void URI_FUNC(LowercaseInplace)(
+        const URI_CHAR * first, const URI_CHAR * afterLast) {
     if ((first != NULL) && (afterLast != NULL) && (afterLast > first)) {
         URI_CHAR * i = (URI_CHAR *)first;
         const int lowerUpperDiff = (_UT('a') - _UT('A'));
@@ -233,9 +228,8 @@ static URI_INLINE void URI_FUNC(LowercaseInplace)(const URI_CHAR * first,
     }
 }

-static URI_INLINE void
-URI_FUNC(LowercaseInplaceExceptPercentEncoding)(const URI_CHAR * first,
-                                                const URI_CHAR * afterLast) {
+static URI_INLINE void URI_FUNC(LowercaseInplaceExceptPercentEncoding)(
+        const URI_CHAR * first, const URI_CHAR * afterLast) {
     if ((first != NULL) && (afterLast != NULL) && (afterLast > first)) {
         URI_CHAR * i = (URI_CHAR *)first;
         const int lowerUpperDiff = (_UT('a') - _UT('A'));
@@ -252,15 +246,14 @@ URI_FUNC(LowercaseInplaceExceptPercentEncoding)(const URI_CHAR * first,
     }
 }

-static URI_INLINE UriBool URI_FUNC(LowercaseMalloc)(const URI_CHAR ** first,
-                                                    const URI_CHAR ** afterLast,
-                                                    UriMemoryManager * memory) {
+static URI_INLINE UriBool URI_FUNC(LowercaseMalloc)(
+        const URI_CHAR ** first, const URI_CHAR ** afterLast, UriMemoryManager * memory) {
     const int lowerUpperDiff = (_UT('a') - _UT('A'));
     URI_CHAR * buffer;
     size_t i = 0;

     if ((first == NULL) || (afterLast == NULL) || (*first == NULL)
-        || (*afterLast == NULL)) {
+            || (*afterLast == NULL)) {
         return URI_FALSE;
     }

@@ -293,10 +286,9 @@ static URI_INLINE UriBool URI_FUNC(LowercaseMalloc)(const URI_CHAR ** first,
 }

 /* NOTE: Implementation must stay inplace-compatible */
-static URI_INLINE void
-URI_FUNC(FixPercentEncodingEngine)(const URI_CHAR * inFirst, const URI_CHAR * inAfterLast,
-                                   const URI_CHAR * outFirst,
-                                   const URI_CHAR ** outAfterLast) {
+static URI_INLINE void URI_FUNC(FixPercentEncodingEngine)(const URI_CHAR * inFirst,
+        const URI_CHAR * inAfterLast, const URI_CHAR * outFirst,
+        const URI_CHAR ** outAfterLast) {
     URI_CHAR * write = (URI_CHAR *)outFirst;
     const size_t lenInChars = inAfterLast - inFirst;
     size_t i = 0;
@@ -339,8 +331,8 @@ URI_FUNC(FixPercentEncodingEngine)(const URI_CHAR * inFirst, const URI_CHAR * in
     *outAfterLast = write;
 }

-static URI_INLINE void URI_FUNC(FixPercentEncodingInplace)(const URI_CHAR * first,
-                                                           const URI_CHAR ** afterLast) {
+static URI_INLINE void URI_FUNC(FixPercentEncodingInplace)(
+        const URI_CHAR * first, const URI_CHAR ** afterLast) {
     /* Death checks */
     if ((first == NULL) || (afterLast == NULL) || (*afterLast == NULL)) {
         return;
@@ -350,14 +342,13 @@ static URI_INLINE void URI_FUNC(FixPercentEncodingInplace)(const URI_CHAR * firs
     URI_FUNC(FixPercentEncodingEngine)(first, *afterLast, first, afterLast);
 }

-static URI_INLINE UriBool URI_FUNC(FixPercentEncodingMalloc)(const URI_CHAR ** first,
-                                                             const URI_CHAR ** afterLast,
-                                                             UriMemoryManager * memory) {
+static URI_INLINE UriBool URI_FUNC(FixPercentEncodingMalloc)(
+        const URI_CHAR ** first, const URI_CHAR ** afterLast, UriMemoryManager * memory) {
     URI_CHAR * buffer;

     /* Death checks */
     if ((first == NULL) || (afterLast == NULL) || (*first == NULL)
-        || (*afterLast == NULL)) {
+            || (*afterLast == NULL)) {
         return URI_FALSE;
     }

@@ -385,11 +376,9 @@ static URI_INLINE UriBool URI_FUNC(FixPercentEncodingMalloc)(const URI_CHAR ** f
 }

 static URI_INLINE UriBool URI_FUNC(MakeRangeOwner)(unsigned int * revertMask,
-                                                   unsigned int maskTest,
-                                                   URI_TYPE(TextRange) * range,
-                                                   UriMemoryManager * memory) {
+        unsigned int maskTest, URI_TYPE(TextRange) * range, UriMemoryManager * memory) {
     if (((*revertMask & maskTest) == 0) && (range->first != NULL)
-        && (range->afterLast != NULL) && (range->afterLast > range->first)) {
+            && (range->afterLast != NULL) && (range->afterLast > range->first)) {
         if (URI_FUNC(CopyRange)(range, range, memory) == URI_FALSE) {
             return URI_FALSE;
         }
@@ -398,18 +387,17 @@ static URI_INLINE UriBool URI_FUNC(MakeRangeOwner)(unsigned int * revertMask,
     return URI_TRUE;
 }

-static URI_INLINE UriBool URI_FUNC(MakeOwnerEngine)(URI_TYPE(Uri) * uri,
-                                                    unsigned int * revertMask,
-                                                    UriMemoryManager * memory) {
+static URI_INLINE UriBool URI_FUNC(MakeOwnerEngine)(
+        URI_TYPE(Uri) * uri, unsigned int * revertMask, UriMemoryManager * memory) {
     URI_TYPE(PathSegment) * walker = uri->pathHead;
-    if (!URI_FUNC(MakeRangeOwner)(revertMask, URI_NORMALIZE_SCHEME, &(uri->scheme),
-                                  memory)
-        || !URI_FUNC(MakeRangeOwner)(revertMask, URI_NORMALIZE_USER_INFO,
-                                     &(uri->userInfo), memory)
-        || !URI_FUNC(MakeRangeOwner)(revertMask, URI_NORMALIZE_QUERY, &(uri->query),
-                                     memory)
-        || !URI_FUNC(MakeRangeOwner)(revertMask, URI_NORMALIZE_FRAGMENT, &(uri->fragment),
-                                     memory)) {
+    if (!URI_FUNC(MakeRangeOwner)(
+                revertMask, URI_NORMALIZE_SCHEME, &(uri->scheme), memory)
+            || !URI_FUNC(MakeRangeOwner)(
+                    revertMask, URI_NORMALIZE_USER_INFO, &(uri->userInfo), memory)
+            || !URI_FUNC(MakeRangeOwner)(
+                    revertMask, URI_NORMALIZE_QUERY, &(uri->query), memory)
+            || !URI_FUNC(MakeRangeOwner)(
+                    revertMask, URI_NORMALIZE_FRAGMENT, &(uri->fragment), memory)) {
         return URI_FALSE; /* Raises malloc error */
     }

@@ -418,15 +406,15 @@ static URI_INLINE UriBool URI_FUNC(MakeOwnerEngine)(URI_TYPE(Uri) * uri,
         if (uri->hostData.ipFuture.first != NULL) {
             /* IPvFuture */
             if (!URI_FUNC(MakeRangeOwner)(revertMask, URI_NORMALIZE_HOST,
-                                          &(uri->hostData.ipFuture), memory)) {
+                        &(uri->hostData.ipFuture), memory)) {
                 return URI_FALSE; /* Raises malloc error */
             }
             uri->hostText.first = uri->hostData.ipFuture.first;
             uri->hostText.afterLast = uri->hostData.ipFuture.afterLast;
         } else if (uri->hostText.first != NULL) {
             /* Regname */
-            if (!URI_FUNC(MakeRangeOwner)(revertMask, URI_NORMALIZE_HOST,
-                                          &(uri->hostText), memory)) {
+            if (!URI_FUNC(MakeRangeOwner)(
+                        revertMask, URI_NORMALIZE_HOST, &(uri->hostText), memory)) {
                 return URI_FALSE; /* Raises malloc error */
             }
         }
@@ -443,7 +431,7 @@ static URI_INLINE UriBool URI_FUNC(MakeOwnerEngine)(URI_TYPE(Uri) * uri,
                 while (ranger != walker) {
                     URI_TYPE(PathSegment) * const next = ranger->next;
                     if ((ranger->text.first != NULL) && (ranger->text.afterLast != NULL)
-                        && (ranger->text.afterLast > ranger->text.first)) {
+                            && (ranger->text.afterLast > ranger->text.first)) {
                         memory->free(memory, (URI_CHAR *)ranger->text.first);
                     }
                     memory->free(memory, ranger);
@@ -482,13 +470,14 @@ unsigned int URI_FUNC(NormalizeSyntaxMaskRequired)(const URI_TYPE(Uri) * uri) {
     return outMask;
 }

-int URI_FUNC(NormalizeSyntaxMaskRequiredEx)(const URI_TYPE(Uri) * uri,
-                                            unsigned int * outMask) {
+int URI_FUNC(NormalizeSyntaxMaskRequiredEx)(
+        const URI_TYPE(Uri) * uri, unsigned int * outMask) {
     UriMemoryManager * const memory = NULL; /* no use of memory manager */

 #  if defined(__GNUC__) \
-      && ((__GNUC__ > 4) \
-          || ((__GNUC__ == 4) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 2)))
+          && ((__GNUC__ > 4) \
+                  || ((__GNUC__ == 4) && defined(__GNUC_MINOR__) \
+                          && (__GNUC_MINOR__ >= 2)))
     /* Slower code that fixes a warning, not sure if this is a smart idea */
     URI_TYPE(Uri) writeableClone;
 #  endif
@@ -498,8 +487,9 @@ int URI_FUNC(NormalizeSyntaxMaskRequiredEx)(const URI_TYPE(Uri) * uri,
     }

 #  if defined(__GNUC__) \
-      && ((__GNUC__ > 4) \
-          || ((__GNUC__ == 4) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 2)))
+          && ((__GNUC__ > 4) \
+                  || ((__GNUC__ == 4) && defined(__GNUC_MINOR__) \
+                          && (__GNUC_MINOR__ >= 2)))
     /* Slower code that fixes a warning, not sure if this is a smart idea */
     memcpy(&writeableClone, uri, 1 * sizeof(URI_TYPE(Uri)));
     URI_FUNC(NormalizeSyntaxEngine)(&writeableClone, 0, outMask, memory);
@@ -513,8 +503,8 @@ int URI_FUNC(NormalizeSyntaxEx)(URI_TYPE(Uri) * uri, unsigned int mask) {
     return URI_FUNC(NormalizeSyntaxExMm)(uri, mask, NULL);
 }

-int URI_FUNC(NormalizeSyntaxExMm)(URI_TYPE(Uri) * uri, unsigned int mask,
-                                  UriMemoryManager * memory) {
+int URI_FUNC(NormalizeSyntaxExMm)(
+        URI_TYPE(Uri) * uri, unsigned int mask, UriMemoryManager * memory) {
     URI_CHECK_MEMORY_MANAGER(memory); /* may return */
     return URI_FUNC(NormalizeSyntaxEngine)(uri, mask, NULL, memory);
 }
@@ -523,8 +513,8 @@ int URI_FUNC(NormalizeSyntax)(URI_TYPE(Uri) * uri) {
     return URI_FUNC(NormalizeSyntaxEx)(uri, (unsigned int)-1);
 }

-static const URI_CHAR * URI_FUNC(PastLeadingZeros)(const URI_CHAR * first,
-                                                   const URI_CHAR * afterLast) {
+static const URI_CHAR * URI_FUNC(PastLeadingZeros)(
+        const URI_CHAR * first, const URI_CHAR * afterLast) {
     assert(first != NULL);
     assert(afterLast != NULL);
     assert(first != afterLast);
@@ -547,8 +537,8 @@ static const URI_CHAR * URI_FUNC(PastLeadingZeros)(const URI_CHAR * first,
     return remainderFirst;
 }

-static void URI_FUNC(DropLeadingZerosInplace)(URI_CHAR * first,
-                                              const URI_CHAR ** afterLast) {
+static void URI_FUNC(DropLeadingZerosInplace)(
+        URI_CHAR * first, const URI_CHAR ** afterLast) {
     assert(first != NULL);
     assert(afterLast != NULL);
     assert(*afterLast != NULL);
@@ -567,8 +557,8 @@ static void URI_FUNC(DropLeadingZerosInplace)(URI_CHAR * first,
     }
 }

-static void URI_FUNC(AdvancePastLeadingZeros)(const URI_CHAR ** first,
-                                              const URI_CHAR * afterLast) {
+static void URI_FUNC(AdvancePastLeadingZeros)(
+        const URI_CHAR ** first, const URI_CHAR * afterLast) {
     assert(first != NULL);
     assert(*first != NULL);
     assert(afterLast != NULL);
@@ -584,9 +574,7 @@ static void URI_FUNC(AdvancePastLeadingZeros)(const URI_CHAR ** first,
 }

 static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri,
-                                                      unsigned int inMask,
-                                                      unsigned int * outMask,
-                                                      UriMemoryManager * memory) {
+        unsigned int inMask, unsigned int * outMask, UriMemoryManager * memory) {
     unsigned int revertMask = URI_NORMALIZED;

     /* Not just doing inspection? -> memory manager required! */
@@ -613,10 +601,10 @@ static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri,

     /* Scheme, host */
     if (outMask != NULL) {
-        const UriBool normalizeScheme =
-            URI_FUNC(ContainsUppercaseLetters)(uri->scheme.first, uri->scheme.afterLast);
+        const UriBool normalizeScheme = URI_FUNC(ContainsUppercaseLetters)(
+                uri->scheme.first, uri->scheme.afterLast);
         const UriBool normalizeHostCase = URI_FUNC(ContainsUppercaseLetters)(
-            uri->hostText.first, uri->hostText.afterLast);
+                uri->hostText.first, uri->hostText.afterLast);
         if (normalizeScheme) {
             *outMask |= URI_NORMALIZE_SCHEME;
         }
@@ -625,7 +613,7 @@ static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri,
             *outMask |= URI_NORMALIZE_HOST;
         } else {
             const UriBool normalizeHostPrecent = URI_FUNC(ContainsUglyPercentEncoding)(
-                uri->hostText.first, uri->hostText.afterLast);
+                    uri->hostText.first, uri->hostText.afterLast);
             if (normalizeHostPrecent) {
                 *outMask |= URI_NORMALIZE_HOST;
             }
@@ -636,8 +624,8 @@ static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri,
             if (uri->owner) {
                 URI_FUNC(LowercaseInplace)(uri->scheme.first, uri->scheme.afterLast);
             } else {
-                if (!URI_FUNC(LowercaseMalloc)(&(uri->scheme.first),
-                                               &(uri->scheme.afterLast), memory)) {
+                if (!URI_FUNC(LowercaseMalloc)(
+                            &(uri->scheme.first), &(uri->scheme.afterLast), memory)) {
                     URI_FUNC(PreventLeakage)(uri, revertMask, memory);
                     return URI_ERROR_MALLOC;
                 }
@@ -651,11 +639,10 @@ static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri,
                 /* IPvFuture */
                 if (uri->owner) {
                     URI_FUNC(LowercaseInplace)(uri->hostData.ipFuture.first,
-                                               uri->hostData.ipFuture.afterLast);
+                            uri->hostData.ipFuture.afterLast);
                 } else {
                     if (!URI_FUNC(LowercaseMalloc)(&(uri->hostData.ipFuture.first),
-                                                   &(uri->hostData.ipFuture.afterLast),
-                                                   memory)) {
+                                &(uri->hostData.ipFuture.afterLast), memory)) {
                         URI_FUNC(PreventLeakage)(uri, revertMask, memory);
                         return URI_ERROR_MALLOC;
                     }
@@ -666,19 +653,19 @@ static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri,
             } else if ((uri->hostText.first != NULL) && (uri->hostData.ip4 == NULL)) {
                 /* Regname or IPv6 */
                 if (uri->owner) {
-                    URI_FUNC(FixPercentEncodingInplace)(uri->hostText.first,
-                                                        &(uri->hostText.afterLast));
+                    URI_FUNC(FixPercentEncodingInplace)(
+                            uri->hostText.first, &(uri->hostText.afterLast));
                 } else {
-                    if (!URI_FUNC(FixPercentEncodingMalloc)(
-                            &(uri->hostText.first), &(uri->hostText.afterLast), memory)) {
+                    if (!URI_FUNC(FixPercentEncodingMalloc)(&(uri->hostText.first),
+                                &(uri->hostText.afterLast), memory)) {
                         URI_FUNC(PreventLeakage)(uri, revertMask, memory);
                         return URI_ERROR_MALLOC;
                     }
                     revertMask |= URI_NORMALIZE_HOST;
                 }

-                URI_FUNC(LowercaseInplaceExceptPercentEncoding)(uri->hostText.first,
-                                                                uri->hostText.afterLast);
+                URI_FUNC(LowercaseInplaceExceptPercentEncoding)(
+                        uri->hostText.first, uri->hostText.afterLast);
             }
         }
     }
@@ -698,11 +685,11 @@ static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri,
         /* Normalize the port, i.e. drop leading zeros (except for string "0") */
         if ((inMask & URI_NORMALIZE_PORT) && (uri->portText.first != NULL)) {
             if (uri->owner) {
-                URI_FUNC(DropLeadingZerosInplace)((URI_CHAR *)uri->portText.first,
-                                                  &(uri->portText.afterLast));
+                URI_FUNC(DropLeadingZerosInplace)(
+                        (URI_CHAR *)uri->portText.first, &(uri->portText.afterLast));
             } else {
-                URI_FUNC(AdvancePastLeadingZeros)(&(uri->portText.first),
-                                                  uri->portText.afterLast);
+                URI_FUNC(AdvancePastLeadingZeros)(
+                        &(uri->portText.first), uri->portText.afterLast);
             }
         }
     }
@@ -710,18 +697,18 @@ static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri,
     /* User info */
     if (outMask != NULL) {
         const UriBool normalizeUserInfo = URI_FUNC(ContainsUglyPercentEncoding)(
-            uri->userInfo.first, uri->userInfo.afterLast);
+                uri->userInfo.first, uri->userInfo.afterLast);
         if (normalizeUserInfo) {
             *outMask |= URI_NORMALIZE_USER_INFO;
         }
     } else {
         if ((inMask & URI_NORMALIZE_USER_INFO) && (uri->userInfo.first != NULL)) {
             if (uri->owner) {
-                URI_FUNC(FixPercentEncodingInplace)(uri->userInfo.first,
-                                                    &(uri->userInfo.afterLast));
+                URI_FUNC(FixPercentEncodingInplace)(
+                        uri->userInfo.first, &(uri->userInfo.afterLast));
             } else {
                 if (!URI_FUNC(FixPercentEncodingMalloc)(
-                        &(uri->userInfo.first), &(uri->userInfo.afterLast), memory)) {
+                            &(uri->userInfo.first), &(uri->userInfo.afterLast), memory)) {
                     URI_FUNC(PreventLeakage)(uri, revertMask, memory);
                     return URI_ERROR_MALLOC;
                 }
@@ -737,10 +724,10 @@ static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri,
             const URI_CHAR * const first = walker->text.first;
             const URI_CHAR * const afterLast = walker->text.afterLast;
             if ((first != NULL) && (afterLast != NULL) && (afterLast > first)
-                && ((((afterLast - first) == 1) && (first[0] == _UT('.')))
-                    || (((afterLast - first) == 2) && (first[0] == _UT('.'))
-                        && (first[1] == _UT('.')))
-                    || URI_FUNC(ContainsUglyPercentEncoding)(first, afterLast))) {
+                    && ((((afterLast - first) == 1) && (first[0] == _UT('.')))
+                            || (((afterLast - first) == 2) && (first[0] == _UT('.'))
+                                    && (first[1] == _UT('.')))
+                            || URI_FUNC(ContainsUglyPercentEncoding)(first, afterLast))) {
                 *outMask |= URI_NORMALIZE_PATH;
                 break;
             }
@@ -748,21 +735,22 @@ static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri,
         }
     } else if (inMask & URI_NORMALIZE_PATH) {
         URI_TYPE(PathSegment) * walker;
-        const UriBool relative =
-            ((uri->scheme.first == NULL) && !uri->absolutePath) ? URI_TRUE : URI_FALSE;
+        const UriBool relative = ((uri->scheme.first == NULL) && !uri->absolutePath)
+                                         ? URI_TRUE
+                                         : URI_FALSE;

         /* Fix percent-encoding for each segment */
         walker = uri->pathHead;
         if (uri->owner) {
             while (walker != NULL) {
-                URI_FUNC(FixPercentEncodingInplace)(walker->text.first,
-                                                    &(walker->text.afterLast));
+                URI_FUNC(FixPercentEncodingInplace)(
+                        walker->text.first, &(walker->text.afterLast));
                 walker = walker->next;
             }
         } else {
             while (walker != NULL) {
                 if (!URI_FUNC(FixPercentEncodingMalloc)(
-                        &(walker->text.first), &(walker->text.afterLast), memory)) {
+                            &(walker->text.first), &(walker->text.afterLast), memory)) {
                     URI_FUNC(PreventLeakage)(uri, revertMask, memory);
                     return URI_ERROR_MALLOC;
                 }
@@ -772,10 +760,9 @@ static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri,
         }

         /* 6.2.2.3 Path Segment Normalization */
-        if (!URI_FUNC(RemoveDotSegmentsEx)(
-                uri, relative,
-                (uri->owner == URI_TRUE) || ((revertMask & URI_NORMALIZE_PATH) != 0),
-                memory)) {
+        if (!URI_FUNC(RemoveDotSegmentsEx)(uri, relative,
+                    (uri->owner == URI_TRUE) || ((revertMask & URI_NORMALIZE_PATH) != 0),
+                    memory)) {
             URI_FUNC(PreventLeakage)(uri, revertMask, memory);
             return URI_ERROR_MALLOC;
         }
@@ -784,10 +771,10 @@ static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri,

     /* Query, fragment */
     if (outMask != NULL) {
-        const UriBool normalizeQuery =
-            URI_FUNC(ContainsUglyPercentEncoding)(uri->query.first, uri->query.afterLast);
+        const UriBool normalizeQuery = URI_FUNC(ContainsUglyPercentEncoding)(
+                uri->query.first, uri->query.afterLast);
         const UriBool normalizeFragment = URI_FUNC(ContainsUglyPercentEncoding)(
-            uri->fragment.first, uri->fragment.afterLast);
+                uri->fragment.first, uri->fragment.afterLast);
         if (normalizeQuery) {
             *outMask |= URI_NORMALIZE_QUERY;
         }
@@ -799,11 +786,11 @@ static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri,
         /* Query */
         if ((inMask & URI_NORMALIZE_QUERY) && (uri->query.first != NULL)) {
             if (uri->owner) {
-                URI_FUNC(FixPercentEncodingInplace)(uri->query.first,
-                                                    &(uri->query.afterLast));
+                URI_FUNC(FixPercentEncodingInplace)(
+                        uri->query.first, &(uri->query.afterLast));
             } else {
                 if (!URI_FUNC(FixPercentEncodingMalloc)(
-                        &(uri->query.first), &(uri->query.afterLast), memory)) {
+                            &(uri->query.first), &(uri->query.afterLast), memory)) {
                     URI_FUNC(PreventLeakage)(uri, revertMask, memory);
                     return URI_ERROR_MALLOC;
                 }
@@ -814,11 +801,11 @@ static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri,
         /* Fragment */
         if ((inMask & URI_NORMALIZE_FRAGMENT) && (uri->fragment.first != NULL)) {
             if (uri->owner) {
-                URI_FUNC(FixPercentEncodingInplace)(uri->fragment.first,
-                                                    &(uri->fragment.afterLast));
+                URI_FUNC(FixPercentEncodingInplace)(
+                        uri->fragment.first, &(uri->fragment.afterLast));
             } else {
                 if (!URI_FUNC(FixPercentEncodingMalloc)(
-                        &(uri->fragment.first), &(uri->fragment.afterLast), memory)) {
+                            &(uri->fragment.first), &(uri->fragment.afterLast), memory)) {
                     URI_FUNC(PreventLeakage)(uri, revertMask, memory);
                     return URI_ERROR_MALLOC;
                 }
diff --git a/ext/uri/uriparser/src/UriNormalize.h b/ext/uri/uriparser/src/UriNormalize.h
index 41c87a382c3..7090b5d20d4 100644
--- a/ext/uri/uriparser/src/UriNormalize.h
+++ b/ext/uri/uriparser/src/UriNormalize.h
@@ -39,8 +39,8 @@
  */

 #if (defined(URI_PASS_ANSI) && !defined(URI_NORMALIZE_H_ANSI)) \
-    || (defined(URI_PASS_UNICODE) && !defined(URI_NORMALIZE_H_UNICODE)) \
-    || (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
+        || (defined(URI_PASS_UNICODE) && !defined(URI_NORMALIZE_H_UNICODE)) \
+        || (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
 /* What encodings are enabled? */
 #  include <uriparser/UriDefsConfig.h>
 #  if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
@@ -57,9 +57,9 @@
 #    endif
 /* Only one pass for each encoding */
 #  elif (defined(URI_PASS_ANSI) && !defined(URI_NORMALIZE_H_ANSI) \
-         && defined(URI_ENABLE_ANSI)) \
-      || (defined(URI_PASS_UNICODE) && !defined(URI_NORMALIZE_H_UNICODE) \
-          && defined(URI_ENABLE_UNICODE))
+          && defined(URI_ENABLE_ANSI)) \
+          || (defined(URI_PASS_UNICODE) && !defined(URI_NORMALIZE_H_UNICODE) \
+                  && defined(URI_ENABLE_UNICODE))
 #    ifdef URI_PASS_ANSI
 #      define URI_NORMALIZE_H_ANSI 1
 #      include <uriparser/UriDefsAnsi.h>
@@ -68,8 +68,8 @@
 #      include <uriparser/UriDefsUnicode.h>
 #    endif

-void URI_FUNC(PreventLeakage)(URI_TYPE(Uri) * uri, unsigned int revertMask,
-                              UriMemoryManager * memory);
+void URI_FUNC(PreventLeakage)(
+        URI_TYPE(Uri) * uri, unsigned int revertMask, UriMemoryManager * memory);

 #  endif
 #endif
diff --git a/ext/uri/uriparser/src/UriParse.c b/ext/uri/uriparser/src/UriParse.c
index cada02301e0..a20c290485f 100644
--- a/ext/uri/uriparser/src/UriParse.c
+++ b/ext/uri/uriparser/src/UriParse.c
@@ -75,156 +75,96 @@
 #  endif

 static const URI_CHAR * URI_FUNC(ParseAuthority)(URI_TYPE(ParserState) * state,
-                                                 const URI_CHAR * first,
-                                                 const URI_CHAR * afterLast,
-                                                 UriMemoryManager * memory);
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
 static const URI_CHAR * URI_FUNC(ParseAuthorityTwo)(URI_TYPE(ParserState) * state,
-                                                    const URI_CHAR * first,
-                                                    const URI_CHAR * afterLast);
-static const URI_CHAR * URI_FUNC(ParseHexZero)(const URI_CHAR * first,
-                                               const URI_CHAR * afterLast);
+        const URI_CHAR * first, const URI_CHAR * afterLast);
+static const URI_CHAR * URI_FUNC(ParseHexZero)(
+        const URI_CHAR * first, const URI_CHAR * afterLast);
 static const URI_CHAR * URI_FUNC(ParseHierPart)(URI_TYPE(ParserState) * state,
-                                                const URI_CHAR * first,
-                                                const URI_CHAR * afterLast,
-                                                UriMemoryManager * memory);
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
 static const URI_CHAR * URI_FUNC(ParseIpFutLoop)(URI_TYPE(ParserState) * state,
-                                                 const URI_CHAR * first,
-                                                 const URI_CHAR * afterLast,
-                                                 UriMemoryManager * memory);
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
 static const URI_CHAR * URI_FUNC(ParseIpLit2)(URI_TYPE(ParserState) * state,
-                                              const URI_CHAR * first,
-                                              const URI_CHAR * afterLast,
-                                              UriMemoryManager * memory);
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
 static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * state,
-                                                    const URI_CHAR * first,
-                                                    const URI_CHAR * afterLast,
-                                                    UriMemoryManager * memory);
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
 static const URI_CHAR * URI_FUNC(ParseMustBeSegmentNzNc)(URI_TYPE(ParserState) * state,
-                                                         const URI_CHAR * first,
-                                                         const URI_CHAR * afterLast,
-                                                         UriMemoryManager * memory);
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
 static const URI_CHAR * URI_FUNC(ParseOwnHost)(URI_TYPE(ParserState) * state,
-                                               const URI_CHAR * first,
-                                               const URI_CHAR * afterLast,
-                                               UriMemoryManager * memory);
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
 static const URI_CHAR * URI_FUNC(ParseOwnHost2)(URI_TYPE(ParserState) * state,
-                                                const URI_CHAR * first,
-                                                const URI_CHAR * afterLast,
-                                                UriMemoryManager * memory);
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
 static const URI_CHAR * URI_FUNC(ParseOwnHostUserInfoNz)(URI_TYPE(ParserState) * state,
-                                                         const URI_CHAR * first,
-                                                         const URI_CHAR * afterLast,
-                                                         UriMemoryManager * memory);
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
 static const URI_CHAR * URI_FUNC(ParseOwnPortUserInfo)(URI_TYPE(ParserState) * state,
-                                                       const URI_CHAR * first,
-                                                       const URI_CHAR * afterLast,
-                                                       UriMemoryManager * memory);
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
 static const URI_CHAR * URI_FUNC(ParseOwnUserInfo)(URI_TYPE(ParserState) * state,
-                                                   const URI_CHAR * first,
-                                                   const URI_CHAR * afterLast,
-                                                   UriMemoryManager * memory);
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
 static const URI_CHAR * URI_FUNC(ParsePartHelperTwo)(URI_TYPE(ParserState) * state,
-                                                     const URI_CHAR * first,
-                                                     const URI_CHAR * afterLast,
-                                                     UriMemoryManager * memory);
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
 static const URI_CHAR * URI_FUNC(ParsePathAbsEmpty)(URI_TYPE(ParserState) * state,
-                                                    const URI_CHAR * first,
-                                                    const URI_CHAR * afterLast,
-                                                    UriMemoryManager * memory);
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
 static const URI_CHAR * URI_FUNC(ParsePathAbsNoLeadSlash)(URI_TYPE(ParserState) * state,
-                                                          const URI_CHAR * first,
-                                                          const URI_CHAR * afterLast,
-                                                          UriMemoryManager * memory);
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
 static const URI_CHAR * URI_FUNC(ParsePathRootless)(URI_TYPE(ParserState) * state,
-                                                    const URI_CHAR * first,
-                                                    const URI_CHAR * afterLast,
-                                                    UriMemoryManager * memory);
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
 static const URI_CHAR * URI_FUNC(ParsePchar)(URI_TYPE(ParserState) * state,
-                                             const URI_CHAR * first,
-                                             const URI_CHAR * afterLast,
-                                             UriMemoryManager * memory);
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
 static const URI_CHAR * URI_FUNC(ParsePctEncoded)(URI_TYPE(ParserState) * state,
-                                                  const URI_CHAR * first,
-                                                  const URI_CHAR * afterLast,
-                                                  UriMemoryManager * memory);
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
 static const URI_CHAR * URI_FUNC(ParsePctSubUnres)(URI_TYPE(ParserState) * state,
-                                                   const URI_CHAR * first,
-                                                   const URI_CHAR * afterLast,
-                                                   UriMemoryManager * memory);
-static const URI_CHAR * URI_FUNC(ParsePort)(const URI_CHAR * first,
-                                            const URI_CHAR * afterLast);
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+static const URI_CHAR * URI_FUNC(ParsePort)(
+        const URI_CHAR * first, const URI_CHAR * afterLast);
 static const URI_CHAR * URI_FUNC(ParseQueryFrag)(URI_TYPE(ParserState) * state,
-                                                 const URI_CHAR * first,
-                                                 const URI_CHAR * afterLast,
-                                                 UriMemoryManager * memory);
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
 static const URI_CHAR * URI_FUNC(ParseSegment)(URI_TYPE(ParserState) * state,
-                                               const URI_CHAR * first,
-                                               const URI_CHAR * afterLast,
-                                               UriMemoryManager * memory);
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
 static const URI_CHAR * URI_FUNC(ParseSegmentNz)(URI_TYPE(ParserState) * state,
-                                                 const URI_CHAR * first,
-                                                 const URI_CHAR * afterLast,
-                                                 UriMemoryManager * memory);
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
 static const URI_CHAR * URI_FUNC(ParseSegmentNzNcOrScheme2)(URI_TYPE(ParserState) * state,
-                                                            const URI_CHAR * first,
-                                                            const URI_CHAR * afterLast,
-                                                            UriMemoryManager * memory);
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
 static const URI_CHAR * URI_FUNC(ParseUriReference)(URI_TYPE(ParserState) * state,
-                                                    const URI_CHAR * first,
-                                                    const URI_CHAR * afterLast,
-                                                    UriMemoryManager * memory);
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
 static const URI_CHAR * URI_FUNC(ParseUriTail)(URI_TYPE(ParserState) * state,
-                                               const URI_CHAR * first,
-                                               const URI_CHAR * afterLast,
-                                               UriMemoryManager * memory);
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
 static const URI_CHAR * URI_FUNC(ParseUriTailTwo)(URI_TYPE(ParserState) * state,
-                                                  const URI_CHAR * first,
-                                                  const URI_CHAR * afterLast,
-                                                  UriMemoryManager * memory);
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
 static const URI_CHAR * URI_FUNC(ParseZeroMoreSlashSegs)(URI_TYPE(ParserState) * state,
-                                                         const URI_CHAR * first,
-                                                         const URI_CHAR * afterLast,
-                                                         UriMemoryManager * memory);
-
-static UriBool URI_FUNC(OnExitOwnHost2)(URI_TYPE(ParserState) * state,
-                                        const URI_CHAR * first,
-                                        UriMemoryManager * memory);
-static UriBool URI_FUNC(OnExitOwnHostUserInfo)(URI_TYPE(ParserState) * state,
-                                               const URI_CHAR * first,
-                                               UriMemoryManager * memory);
-static UriBool URI_FUNC(OnExitOwnPortUserInfo)(URI_TYPE(ParserState) * state,
-                                               const URI_CHAR * first,
-                                               UriMemoryManager * memory);
-static UriBool URI_FUNC(OnExitSegmentNzNcOrScheme2)(URI_TYPE(ParserState) * state,
-                                                    const URI_CHAR * first,
-                                                    UriMemoryManager * memory);
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);
+
+static UriBool URI_FUNC(OnExitOwnHost2)(
+        URI_TYPE(ParserState) * state, const URI_CHAR * first, UriMemoryManager * memory);
+static UriBool URI_FUNC(OnExitOwnHostUserInfo)(
+        URI_TYPE(ParserState) * state, const URI_CHAR * first, UriMemoryManager * memory);
+static UriBool URI_FUNC(OnExitOwnPortUserInfo)(
+        URI_TYPE(ParserState) * state, const URI_CHAR * first, UriMemoryManager * memory);
+static UriBool URI_FUNC(OnExitSegmentNzNcOrScheme2)(
+        URI_TYPE(ParserState) * state, const URI_CHAR * first, UriMemoryManager * memory);
 static void URI_FUNC(OnExitPartHelperTwo)(URI_TYPE(ParserState) * state);

 static void URI_FUNC(ResetParserStateExceptUri)(URI_TYPE(ParserState) * state);

 static UriBool URI_FUNC(PushPathSegment)(URI_TYPE(ParserState) * state,
-                                         const URI_CHAR * first,
-                                         const URI_CHAR * afterLast,
-                                         UriMemoryManager * memory);
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);

 static void URI_FUNC(StopSyntax)(URI_TYPE(ParserState) * state, const URI_CHAR * errorPos,
-                                 UriMemoryManager * memory);
-static void URI_FUNC(StopMalloc)(URI_TYPE(ParserState) * state,
-                                 UriMemoryManager * memory);
+        UriMemoryManager * memory);
+static void URI_FUNC(StopMalloc)(
+        URI_TYPE(ParserState) * state, UriMemoryManager * memory);

 static int URI_FUNC(ParseUriExMm)(URI_TYPE(ParserState) * state, const URI_CHAR * first,
-                                  const URI_CHAR * afterLast, UriMemoryManager * memory);
+        const URI_CHAR * afterLast, UriMemoryManager * memory);

 static URI_INLINE void URI_FUNC(StopSyntax)(URI_TYPE(ParserState) * state,
-                                            const URI_CHAR * errorPos,
-                                            UriMemoryManager * memory) {
+        const URI_CHAR * errorPos, UriMemoryManager * memory) {
     URI_FUNC(FreeUriMembersMm)(state->uri, memory);
     state->errorPos = errorPos;
     state->errorCode = URI_ERROR_SYNTAX;
 }

-static URI_INLINE void URI_FUNC(StopMalloc)(URI_TYPE(ParserState) * state,
-                                            UriMemoryManager * memory) {
+static URI_INLINE void URI_FUNC(StopMalloc)(
+        URI_TYPE(ParserState) * state, UriMemoryManager * memory) {
     URI_FUNC(FreeUriMembersMm)(state->uri, memory);
     state->errorPos = NULL;
     state->errorCode = URI_ERROR_MALLOC;
@@ -236,9 +176,7 @@ static URI_INLINE void URI_FUNC(StopMalloc)(URI_TYPE(ParserState) * state,
  * [authority]-><NULL>
  */
 static URI_INLINE const URI_CHAR * URI_FUNC(ParseAuthority)(URI_TYPE(ParserState) * state,
-                                                            const URI_CHAR * first,
-                                                            const URI_CHAR * afterLast,
-                                                            UriMemoryManager * memory) {
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory) {
     if (first >= afterLast) {
         /* "" regname host */
         state->uri->hostText.first = URI_FUNC(SafeToPointTo);
@@ -249,7 +187,7 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseAuthority)(URI_TYPE(ParserState
     switch (*first) {
     case _UT('['): {
         const URI_CHAR * const afterIpLit2 =
-            URI_FUNC(ParseIpLit2)(state, first + 1, afterLast, memory);
+                URI_FUNC(ParseIpLit2)(state, first + 1, afterLast, memory);
         if (afterIpLit2 == NULL) {
             return NULL;
         }
@@ -273,9 +211,9 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseAuthority)(URI_TYPE(ParserState
  * [authorityTwo]-><:>[port]
  * [authorityTwo]-><NULL>
  */
-static URI_INLINE const URI_CHAR *
-URI_FUNC(ParseAuthorityTwo)(URI_TYPE(ParserState) * state, const URI_CHAR * first,
-                            const URI_CHAR * afterLast) {
+static URI_INLINE const URI_CHAR * URI_FUNC(ParseAuthorityTwo)(
+        URI_TYPE(ParserState) * state, const URI_CHAR * first,
+        const URI_CHAR * afterLast) {
     if (first >= afterLast) {
         return afterLast;
     }
@@ -300,8 +238,8 @@ URI_FUNC(ParseAuthorityTwo)(URI_TYPE(ParserState) * state, const URI_CHAR * firs
  * [hexZero]->[HEXDIG][hexZero]
  * [hexZero]-><NULL>
  */
-static const URI_CHAR * URI_FUNC(ParseHexZero)(const URI_CHAR * first,
-                                               const URI_CHAR * afterLast) {
+static const URI_CHAR * URI_FUNC(ParseHexZero)(
+        const URI_CHAR * first, const URI_CHAR * afterLast) {
 tail_call:
     if (first >= afterLast) {
         return afterLast;
@@ -323,9 +261,7 @@ static const URI_CHAR * URI_FUNC(ParseHexZero)(const URI_CHAR * first,
  * [hierPart]-><NULL>
  */
 static URI_INLINE const URI_CHAR * URI_FUNC(ParseHierPart)(URI_TYPE(ParserState) * state,
-                                                           const URI_CHAR * first,
-                                                           const URI_CHAR * afterLast,
-                                                           UriMemoryManager * memory) {
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory) {
     if (first >= afterLast) {
         return afterLast;
     }
@@ -351,9 +287,7 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseHierPart)(URI_TYPE(ParserState)
  * [ipFutStopGo]-><NULL>
  */
 static const URI_CHAR * URI_FUNC(ParseIpFutLoop)(URI_TYPE(ParserState) * state,
-                                                 const URI_CHAR * first,
-                                                 const URI_CHAR * afterLast,
-                                                 UriMemoryManager * memory) {
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory) {
     const URI_CHAR * const originalFirst = first;

     while (first < afterLast) {
@@ -383,9 +317,7 @@ static const URI_CHAR * URI_FUNC(ParseIpFutLoop)(URI_TYPE(ParserState) * state,
  * [ipFuture]-><v>[HEXDIG][hexZero]<.>[ipFutLoop]
  */
 static const URI_CHAR * URI_FUNC(ParseIpFuture)(URI_TYPE(ParserState) * state,
-                                                const URI_CHAR * first,
-                                                const URI_CHAR * afterLast,
-                                                UriMemoryManager * memory) {
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory) {
     if (first >= afterLast) {
         URI_FUNC(StopSyntax)(state, afterLast, memory);
         return NULL;
@@ -408,7 +340,7 @@ static const URI_CHAR * URI_FUNC(ParseIpFuture)(URI_TYPE(ParserState) * state,
     case URI_SET_HEXDIG(_UT): {
         const URI_CHAR * afterIpFutLoop;
         const URI_CHAR * const afterHexZero =
-            URI_FUNC(ParseHexZero)(first + 2, afterLast);
+                URI_FUNC(ParseHexZero)(first + 2, afterLast);
         if (afterHexZero == NULL) {
             return NULL;
         }
@@ -423,7 +355,7 @@ static const URI_CHAR * URI_FUNC(ParseIpFuture)(URI_TYPE(ParserState) * state,
         state->uri->hostText.first = first; /* HOST BEGIN */
         state->uri->hostData.ipFuture.first = first; /* IPFUTURE BEGIN */
         afterIpFutLoop =
-            URI_FUNC(ParseIpFutLoop)(state, afterHexZero + 1, afterLast, memory);
+                URI_FUNC(ParseIpFutLoop)(state, afterHexZero + 1, afterLast, memory);
         if (afterIpFutLoop == NULL) {
             return NULL;
         }
@@ -450,9 +382,7 @@ static const URI_CHAR * URI_FUNC(ParseIpFuture)(URI_TYPE(ParserState) * state,
  * [ipLit2]->[IPv6address2]
  */
 static URI_INLINE const URI_CHAR * URI_FUNC(ParseIpLit2)(URI_TYPE(ParserState) * state,
-                                                         const URI_CHAR * first,
-                                                         const URI_CHAR * afterLast,
-                                                         UriMemoryManager * memory) {
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory) {
     if (first >= afterLast) {
         URI_FUNC(StopSyntax)(state, afterLast, memory);
         return NULL;
@@ -463,7 +393,7 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseIpLit2)(URI_TYPE(ParserState) *
     case _UT('v'):
     case _UT('V'): {
         const URI_CHAR * const afterIpFuture =
-            URI_FUNC(ParseIpFuture)(state, first, afterLast, memory);
+                URI_FUNC(ParseIpFuture)(state, first, afterLast, memory);
         if (afterIpFuture == NULL) {
             return NULL;
         }
@@ -482,7 +412,7 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseIpLit2)(URI_TYPE(ParserState) *
     case _UT(']'):
     case URI_SET_HEXDIG(_UT):
         state->uri->hostData.ip6 = memory->malloc(
-            memory, 1 * sizeof(UriIp6)); /* Freed when stopping on parse error */
+                memory, 1 * sizeof(UriIp6)); /* Freed when stopping on parse error */
         if (state->uri->hostData.ip6 == NULL) {
             URI_FUNC(StopMalloc)(state, memory);
             return NULL;
@@ -499,9 +429,7 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseIpLit2)(URI_TYPE(ParserState) *
  * [IPv6address2]->..<]>
  */
 static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * state,
-                                                    const URI_CHAR * first,
-                                                    const URI_CHAR * afterLast,
-                                                    UriMemoryManager * memory) {
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory) {
     int zipperEver = 0;
     int quadsDone = 0;
     int digitCount = 0;
@@ -532,7 +460,7 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat

                 case _UT('.'):
                     if ((ip4OctetsDone == 4) /* NOTE! */
-                        || (digitCount == 0) || (digitCount == 4)) {
+                            || (digitCount == 0) || (digitCount == 4)) {
                         /* Invalid digit or octet count */
                         URI_FUNC(StopSyntax)(state, first, memory);
                         return NULL;
@@ -542,8 +470,8 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat
                         return NULL;
                     } else if ((digitCount == 3)
                                && (100 * digitHistory[0] + 10 * digitHistory[1]
-                                       + digitHistory[2]
-                                   > 255)) {
+                                               + digitHistory[2]
+                                       > 255)) {
                         /* Octet value too large */
                         if (digitHistory[0] > 2) {
                             URI_FUNC(StopSyntax)(state, first - 3, memory);
@@ -557,14 +485,14 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat

                     /* Copy IPv4 octet */
                     state->uri->hostData.ip6->data[16 - 4 + ip4OctetsDone] =
-                        uriGetOctetValue(digitHistory, digitCount);
+                            uriGetOctetValue(digitHistory, digitCount);
                     digitCount = 0;
                     ip4OctetsDone++;
                     break;

                 case _UT(']'):
                     if ((ip4OctetsDone != 3) /* NOTE! */
-                        || (digitCount == 0) || (digitCount == 4)) {
+                            || (digitCount == 0) || (digitCount == 4)) {
                         /* Invalid digit or octet count */
                         URI_FUNC(StopSyntax)(state, first, memory);
                         return NULL;
@@ -574,8 +502,8 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat
                         return NULL;
                     } else if ((digitCount == 3)
                                && (100 * digitHistory[0] + 10 * digitHistory[1]
-                                       + digitHistory[2]
-                                   > 255)) {
+                                               + digitHistory[2]
+                                       > 255)) {
                         /* Octet value too large */
                         if (digitHistory[0] > 2) {
                             URI_FUNC(StopSyntax)(state, first - 3, memory);
@@ -591,12 +519,12 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat

                     /* Copy missing quads right before IPv4 */
                     memcpy(state->uri->hostData.ip6->data + 16 - 4
-                               - 2 * quadsAfterZipperCount,
-                           quadsAfterZipper, 2 * quadsAfterZipperCount);
+                                    - 2 * quadsAfterZipperCount,
+                            quadsAfterZipper, 2 * quadsAfterZipperCount);

                     /* Copy last IPv4 octet */
                     state->uri->hostData.ip6->data[16 - 4 + 3] =
-                        uriGetOctetValue(digitHistory, digitCount);
+                            uriGetOctetValue(digitHistory, digitCount);

                     return first + 1;

@@ -652,13 +580,11 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat
                     if (digitCount > 0) {
                         if (zipperEver) {
                             uriWriteQuadToDoubleByte(digitHistory, digitCount,
-                                                     quadsAfterZipper
-                                                         + 2 * quadsAfterZipperCount);
+                                    quadsAfterZipper + 2 * quadsAfterZipperCount);
                             quadsAfterZipperCount++;
                         } else {
                             uriWriteQuadToDoubleByte(digitHistory, digitCount,
-                                                     state->uri->hostData.ip6->data
-                                                         + 2 * quadsDone);
+                                    state->uri->hostData.ip6->data + 2 * quadsDone);
                         }
                         quadsDone++;
                         digitCount = 0;
@@ -687,7 +613,7 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat

                         /* Zero everything after zipper */
                         memset(state->uri->hostData.ip6->data + resetOffset, 0,
-                               16 - resetOffset);
+                                16 - resetOffset);
                         setZipper = 1;

                         /* ":::+"? */
@@ -712,8 +638,8 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat

                 case _UT('.'):
                     if ((quadsDone + zipperEver > 6) /* NOTE */
-                        || (!zipperEver && (quadsDone < 6)) || letterAmong
-                        || (digitCount == 0) || (digitCount == 4)) {
+                            || (!zipperEver && (quadsDone < 6)) || letterAmong
+                            || (digitCount == 0) || (digitCount == 4)) {
                         /* Invalid octet before */
                         URI_FUNC(StopSyntax)(state, first, memory);
                         return NULL;
@@ -723,8 +649,8 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat
                         return NULL;
                     } else if ((digitCount == 3)
                                && (100 * digitHistory[0] + 10 * digitHistory[1]
-                                       + digitHistory[2]
-                                   > 255)) {
+                                               + digitHistory[2]
+                                       > 255)) {
                         /* Octet value too large */
                         if (digitHistory[0] > 2) {
                             URI_FUNC(StopSyntax)(state, first - 3, memory);
@@ -738,7 +664,7 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat

                     /* Copy first IPv4 octet */
                     state->uri->hostData.ip6->data[16 - 4] =
-                        uriGetOctetValue(digitHistory, digitCount);
+                            uriGetOctetValue(digitHistory, digitCount);
                     digitCount = 0;

                     /* Switch over to IPv4 loop */
@@ -761,13 +687,11 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat
                                 return NULL;
                             }
                             uriWriteQuadToDoubleByte(digitHistory, digitCount,
-                                                     quadsAfterZipper
-                                                         + 2 * quadsAfterZipperCount);
+                                    quadsAfterZipper + 2 * quadsAfterZipperCount);
                             quadsAfterZipperCount++;
                         } else {
                             uriWriteQuadToDoubleByte(digitHistory, digitCount,
-                                                     state->uri->hostData.ip6->data
-                                                         + 2 * quadsDone);
+                                    state->uri->hostData.ip6->data + 2 * quadsDone);
                         }
                         /*
                         quadsDone++;
@@ -777,8 +701,8 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat

                     /* Copy missing quads to the end */
                     memcpy(state->uri->hostData.ip6->data + 16
-                               - 2 * quadsAfterZipperCount,
-                           quadsAfterZipper, 2 * quadsAfterZipperCount);
+                                    - 2 * quadsAfterZipperCount,
+                            quadsAfterZipper, 2 * quadsAfterZipperCount);

                     state->uri->hostText.afterLast = first; /* HOST END */
                     return first + 1; /* Fine */
@@ -807,13 +731,11 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat
  * [mustBeSegmentNzNc]-><@>[mustBeSegmentNzNc]
  */
 static const URI_CHAR * URI_FUNC(ParseMustBeSegmentNzNc)(URI_TYPE(ParserState) * state,
-                                                         const URI_CHAR * first,
-                                                         const URI_CHAR * afterLast,
-                                                         UriMemoryManager * memory) {
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory) {
 tail_call:
     if (first >= afterLast) {
-        if (!URI_FUNC(PushPathSegment)(state, state->uri->scheme.first, first,
-                                       memory)) { /* SEGMENT BOTH */
+        if (!URI_FUNC(PushPathSegment)(
+                    state, state->uri->scheme.first, first, memory)) { /* SEGMENT BOTH */
             URI_FUNC(StopMalloc)(state, memory);
             return NULL;
         }
@@ -824,7 +746,7 @@ static const URI_CHAR * URI_FUNC(ParseMustBeSegmentNzNc)(URI_TYPE(ParserState) *
     switch (*first) {
     case _UT('%'): {
         const URI_CHAR * const afterPctEncoded =
-            URI_FUNC(ParsePctEncoded)(state, first, afterLast, memory);
+                URI_FUNC(ParsePctEncoded)(state, first, afterLast, memory);
         if (afterPctEncoded == NULL) {
             return NULL;
         }
@@ -841,8 +763,8 @@ static const URI_CHAR * URI_FUNC(ParseMustBeSegmentNzNc)(URI_TYPE(ParserState) *
     case _UT('/'): {
         const URI_CHAR * afterZeroMoreSlashSegs;
         const URI_CHAR * afterSegment;
-        if (!URI_FUNC(PushPathSegment)(state, state->uri->scheme.first, first,
-                                       memory)) { /* SEGMENT BOTH */
+        if (!URI_FUNC(PushPathSegment)(
+                    state, state->uri->scheme.first, first, memory)) { /* SEGMENT BOTH */
             URI_FUNC(StopMalloc)(state, memory);
             return NULL;
         }
@@ -851,13 +773,13 @@ static const URI_CHAR * URI_FUNC(ParseMustBeSegmentNzNc)(URI_TYPE(ParserState) *
         if (afterSegment == NULL) {
             return NULL;
         }
-        if (!URI_FUNC(PushPathSegment)(state, first + 1, afterSegment,
-                                       memory)) { /* SEGMENT BOTH */
+        if (!URI_FUNC(PushPathSegment)(
+                    state, first + 1, afterSegment, memory)) { /* SEGMENT BOTH */
             URI_FUNC(StopMalloc)(state, memory);
             return NULL;
         }
         afterZeroMoreSlashSegs =
-            URI_FUNC(ParseZeroMoreSlashSegs)(state, afterSegment, afterLast, memory);
+                URI_FUNC(ParseZeroMoreSlashSegs)(state, afterSegment, afterLast, memory);
         if (afterZeroMoreSlashSegs == NULL) {
             return NULL;
         }
@@ -865,8 +787,8 @@ static const URI_CHAR * URI_FUNC(ParseMustBeSegmentNzNc)(URI_TYPE(ParserState) *
     }

     default:
-        if (!URI_FUNC(PushPathSegment)(state, state->uri->scheme.first, first,
-                                       memory)) { /* SEGMENT BOTH */
+        if (!URI_FUNC(PushPathSegment)(
+                    state, state->uri->scheme.first, first, memory)) { /* SEGMENT BOTH */
             URI_FUNC(StopMalloc)(state, memory);
             return NULL;
         }
@@ -880,9 +802,7 @@ static const URI_CHAR * URI_FUNC(ParseMustBeSegmentNzNc)(URI_TYPE(ParserState) *
  * [ownHost]->[ownHost2] // can take <NULL>
  */
 static URI_INLINE const URI_CHAR * URI_FUNC(ParseOwnHost)(URI_TYPE(ParserState) * state,
-                                                          const URI_CHAR * first,
-                                                          const URI_CHAR * afterLast,
-                                                          UriMemoryManager * memory) {
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory) {
     if (first >= afterLast) {
         state->uri->hostText.afterLast = afterLast; /* HOST END */
         return afterLast;
@@ -891,7 +811,7 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseOwnHost)(URI_TYPE(ParserState)
     switch (*first) {
     case _UT('['): {
         const URI_CHAR * const afterIpLit2 =
-            URI_FUNC(ParseIpLit2)(state, first + 1, afterLast, memory);
+                URI_FUNC(ParseIpLit2)(state, first + 1, afterLast, memory);
         if (afterIpLit2 == NULL) {
             return NULL;
         }
@@ -905,19 +825,17 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseOwnHost)(URI_TYPE(ParserState)
 }

 static URI_INLINE UriBool URI_FUNC(OnExitOwnHost2)(URI_TYPE(ParserState) * state,
-                                                   const URI_CHAR * first,
-                                                   UriMemoryManager * memory) {
+        const URI_CHAR * first, UriMemoryManager * memory) {
     state->uri->hostText.afterLast = first; /* HOST END */

     /* Valid IPv4 or just a regname? */
     state->uri->hostData.ip4 = memory->malloc(
-        memory, 1 * sizeof(UriIp4)); /* Freed when stopping on parse error */
+            memory, 1 * sizeof(UriIp4)); /* Freed when stopping on parse error */
     if (state->uri->hostData.ip4 == NULL) {
         return URI_FALSE; /* Raises malloc error */
     }
     if (URI_FUNC(ParseIpFourAddress)(state->uri->hostData.ip4->data,
-                                     state->uri->hostText.first,
-                                     state->uri->hostText.afterLast)) {
+                state->uri->hostText.first, state->uri->hostText.afterLast)) {
         /* Not IPv4 */
         memory->free(memory, state->uri->hostData.ip4);
         state->uri->hostData.ip4 = NULL;
@@ -930,9 +848,7 @@ static URI_INLINE UriBool URI_FUNC(OnExitOwnHost2)(URI_TYPE(ParserState) * state
  * [ownHost2]->[pctSubUnres][ownHost2]
  */
 static const URI_CHAR * URI_FUNC(ParseOwnHost2)(URI_TYPE(ParserState) * state,
-                                                const URI_CHAR * first,
-                                                const URI_CHAR * afterLast,
-                                                UriMemoryManager * memory) {
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory) {
 tail_call:
     if (first >= afterLast) {
         if (!URI_FUNC(OnExitOwnHost2)(state, first, memory)) {
@@ -947,7 +863,7 @@ static const URI_CHAR * URI_FUNC(ParseOwnHost2)(URI_TYPE(ParserState) * state,
     case URI_SET_SUB_DELIMS(_UT):
     case URI_SET_UNRESERVED(_UT): {
         const URI_CHAR * const afterPctSubUnres =
-            URI_FUNC(ParsePctSubUnres)(state, first, afterLast, memory);
+                URI_FUNC(ParsePctSubUnres)(state, first, afterLast, memory);
         if (afterPctSubUnres == NULL) {
             return NULL;
         }
@@ -965,22 +881,20 @@ static const URI_CHAR * URI_FUNC(ParseOwnHost2)(URI_TYPE(ParserState) * state,
 }

 static URI_INLINE UriBool URI_FUNC(OnExitOwnHostUserInfo)(URI_TYPE(ParserState) * state,
-                                                          const URI_CHAR * first,
-                                                          UriMemoryManager * memory) {
+        const URI_CHAR * first, UriMemoryManager * memory) {
     state->uri->hostText.first =
-        state->uri->userInfo.first; /* Host instead of userInfo, update */
+            state->uri->userInfo.first; /* Host instead of userInfo, update */
     state->uri->userInfo.first = NULL; /* Not a userInfo, reset */
     state->uri->hostText.afterLast = first; /* HOST END */

     /* Valid IPv4 or just a regname? */
     state->uri->hostData.ip4 = memory->malloc(
-        memory, 1 * sizeof(UriIp4)); /* Freed when stopping on parse error */
+            memory, 1 * sizeof(UriIp4)); /* Freed when stopping on parse error */
     if (state->uri->hostData.ip4 == NULL) {
         return URI_FALSE; /* Raises malloc error */
     }
     if (URI_FUNC(ParseIpFourAddress)(state->uri->hostData.ip4->data,
-                                     state->uri->hostText.first,
-                                     state->uri->hostText.afterLast)) {
+                state->uri->hostText.first, state->uri->hostText.afterLast)) {
         /* Not IPv4 */
         memory->free(memory, state->uri->hostData.ip4);
         state->uri->hostData.ip4 = NULL;
@@ -997,9 +911,7 @@ static URI_INLINE UriBool URI_FUNC(OnExitOwnHostUserInfo)(URI_TYPE(ParserState)
  * [ownHostUserInfo]-><NULL>
  */
 static const URI_CHAR * URI_FUNC(ParseOwnHostUserInfoNz)(URI_TYPE(ParserState) * state,
-                                                         const URI_CHAR * first,
-                                                         const URI_CHAR * afterLast,
-                                                         UriMemoryManager * memory) {
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory) {
     const URI_CHAR * const originalFirst = first;

     while (first < afterLast) {
@@ -1008,7 +920,7 @@ static const URI_CHAR * URI_FUNC(ParseOwnHostUserInfoNz)(URI_TYPE(ParserState) *
         case URI_SET_SUB_DELIMS(_UT):
         case URI_SET_UNRESERVED(_UT): {
             const URI_CHAR * const afterPctSubUnres =
-                URI_FUNC(ParsePctSubUnres)(state, first, afterLast, memory);
+                    URI_FUNC(ParsePctSubUnres)(state, first, afterLast, memory);
             if (afterPctSubUnres == NULL) {
                 return NULL;
             }
@@ -1054,22 +966,20 @@ static const URI_CHAR * URI_FUNC(ParseOwnHostUserInfoNz)(URI_TYPE(ParserState) *
 }

 static URI_INLINE UriBool URI_FUNC(OnExitOwnPortUserInfo)(URI_TYPE(ParserState) * state,
-                                                          const URI_CHAR * first,
-                                                          UriMemoryManager * memory) {
+        const URI_CHAR * first, UriMemoryManager * memory) {
     state->uri->hostText.first =
-        state->uri->userInfo.first; /* Host instead of userInfo, update */
+            state->uri->userInfo.first; /* Host instead of userInfo, update */
     state->uri->userInfo.first = NULL; /* Not a userInfo, reset */
     state->uri->portText.afterLast = first; /* PORT END */

     /* Valid IPv4 or just a regname? */
     state->uri->hostData.ip4 = memory->malloc(
-        memory, 1 * sizeof(UriIp4)); /* Freed when stopping on parse error */
+            memory, 1 * sizeof(UriIp4)); /* Freed when stopping on parse error */
     if (state->uri->hostData.ip4 == NULL) {
         return URI_FALSE; /* Raises malloc error */
     }
     if (URI_FUNC(ParseIpFourAddress)(state->uri->hostData.ip4->data,
-                                     state->uri->hostText.first,
-                                     state->uri->hostText.afterLast)) {
+                state->uri->hostText.first, state->uri->hostText.afterLast)) {
         /* Not IPv4 */
         memory->free(memory, state->uri->hostData.ip4);
         state->uri->hostData.ip4 = NULL;
@@ -1091,9 +1001,7 @@ static URI_INLINE UriBool URI_FUNC(OnExitOwnPortUserInfo)(URI_TYPE(ParserState)
  * [ownPortUserInfo]-><NULL>
  */
 static const URI_CHAR * URI_FUNC(ParseOwnPortUserInfo)(URI_TYPE(ParserState) * state,
-                                                       const URI_CHAR * first,
-                                                       const URI_CHAR * afterLast,
-                                                       UriMemoryManager * memory) {
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory) {
 tail_call:
     if (first >= afterLast) {
         if (!URI_FUNC(OnExitOwnPortUserInfo)(state, first, memory)) {
@@ -1124,7 +1032,7 @@ static const URI_CHAR * URI_FUNC(ParseOwnPortUserInfo)(URI_TYPE(ParserState) * s
     case _UT('%'):
         state->uri->portText.first = NULL; /* Not a port, reset */
         const URI_CHAR * const afterPct =
-            URI_FUNC(ParsePctEncoded)(state, first, afterLast, memory);
+                URI_FUNC(ParsePctEncoded)(state, first, afterLast, memory);
         if (afterPct == NULL) {
             return NULL;
         }
@@ -1152,9 +1060,7 @@ static const URI_CHAR * URI_FUNC(ParseOwnPortUserInfo)(URI_TYPE(ParserState) * s
  * [ownUserInfo]-><@>[ownHost]
  */
 static const URI_CHAR * URI_FUNC(ParseOwnUserInfo)(URI_TYPE(ParserState) * state,
-                                                   const URI_CHAR * first,
-                                                   const URI_CHAR * afterLast,
-                                                   UriMemoryManager * memory) {
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory) {
 tail_call:
     if (first >= afterLast) {
         URI_FUNC(StopSyntax)(state, afterLast, memory);
@@ -1166,7 +1072,7 @@ static const URI_CHAR * URI_FUNC(ParseOwnUserInfo)(URI_TYPE(ParserState) * state
     case URI_SET_SUB_DELIMS(_UT):
     case URI_SET_UNRESERVED(_UT): {
         const URI_CHAR * const afterPctSubUnres =
-            URI_FUNC(ParsePctSubUnres)(state, first, afterLast, memory);
+                URI_FUNC(ParsePctSubUnres)(state, first, afterLast, memory);
         if (afterPctSubUnres == NULL) {
             return NULL;
         }
@@ -1198,9 +1104,9 @@ static URI_INLINE void URI_FUNC(OnExitPartHelperTwo)(URI_TYPE(ParserState) * sta
  * [partHelperTwo]->[pathAbsNoLeadSlash] // can take <NULL>
  * [partHelperTwo]-></>[authority][pathAbsEmpty]
  */
-static URI_INLINE const URI_CHAR *
-URI_FUNC(ParsePartHelperTwo)(URI_TYPE(ParserState) * state, const URI_CHAR * first,
-                             const URI_CHAR * afterLast, UriMemoryManager * memory) {
+static URI_INLINE const URI_CHAR * URI_FUNC(ParsePartHelperTwo)(
+        URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast,
+        UriMemoryManager * memory) {
     if (first >= afterLast) {
         URI_FUNC(OnExitPartHelperTwo)(state);
         return afterLast;
@@ -1209,13 +1115,13 @@ URI_FUNC(ParsePartHelperTwo)(URI_TYPE(ParserState) * state, const URI_CHAR * fir
     switch (*first) {
     case _UT('/'): {
         const URI_CHAR * const afterAuthority =
-            URI_FUNC(ParseAuthority)(state, first + 1, afterLast, memory);
+                URI_FUNC(ParseAuthority)(state, first + 1, afterLast, memory);
         const URI_CHAR * afterPathAbsEmpty;
         if (afterAuthority == NULL) {
             return NULL;
         }
         afterPathAbsEmpty =
-            URI_FUNC(ParsePathAbsEmpty)(state, afterAuthority, afterLast, memory);
+                URI_FUNC(ParsePathAbsEmpty)(state, afterAuthority, afterLast, memory);

         URI_FUNC(FixEmptyTrailSegment)(state->uri, memory);

@@ -1233,9 +1139,7 @@ URI_FUNC(ParsePartHelperTwo)(URI_TYPE(ParserState) * state, const URI_CHAR * fir
  * [pathAbsEmpty]-><NULL>
  */
 static const URI_CHAR * URI_FUNC(ParsePathAbsEmpty)(URI_TYPE(ParserState) * state,
-                                                    const URI_CHAR * first,
-                                                    const URI_CHAR * afterLast,
-                                                    UriMemoryManager * memory) {
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory) {
 tail_call:
     if (first >= afterLast) {
         return afterLast;
@@ -1244,12 +1148,12 @@ static const URI_CHAR * URI_FUNC(ParsePathAbsEmpty)(URI_TYPE(ParserState) * stat
     switch (*first) {
     case _UT('/'): {
         const URI_CHAR * const afterSegment =
-            URI_FUNC(ParseSegment)(state, first + 1, afterLast, memory);
+                URI_FUNC(ParseSegment)(state, first + 1, afterLast, memory);
         if (afterSegment == NULL) {
             return NULL;
         }
-        if (!URI_FUNC(PushPathSegment)(state, first + 1, afterSegment,
-                                       memory)) { /* SEGMENT BOTH */
+        if (!URI_FUNC(PushPathSegment)(
+                    state, first + 1, afterSegment, memory)) { /* SEGMENT BOTH */
             URI_FUNC(StopMalloc)(state, memory);
             return NULL;
         }
@@ -1266,9 +1170,9 @@ static const URI_CHAR * URI_FUNC(ParsePathAbsEmpty)(URI_TYPE(ParserState) * stat
  * [pathAbsNoLeadSlash]->[segmentNz][zeroMoreSlashSegs]
  * [pathAbsNoLeadSlash]-><NULL>
  */
-static URI_INLINE const URI_CHAR *
-URI_FUNC(ParsePathAbsNoLeadSlash)(URI_TYPE(ParserState) * state, const URI_CHAR * first,
-                                  const URI_CHAR * afterLast, UriMemoryManager * memory) {
+static URI_INLINE const URI_CHAR * URI_FUNC(ParsePathAbsNoLeadSlash)(
+        URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast,
+        UriMemoryManager * memory) {
     if (first >= afterLast) {
         return afterLast;
     }
@@ -1276,12 +1180,12 @@ URI_FUNC(ParsePathAbsNoLeadSlash)(URI_TYPE(ParserState) * state, const URI_CHAR
     switch (*first) {
     case URI_SET_PCHAR(_UT): {
         const URI_CHAR * const afterSegmentNz =
-            URI_FUNC(ParseSegmentNz)(state, first, afterLast, memory);
+                URI_FUNC(ParseSegmentNz)(state, first, afterLast, memory);
         if (afterSegmentNz == NULL) {
             return NULL;
         }
-        if (!URI_FUNC(PushPathSegment)(state, first, afterSegmentNz,
-                                       memory)) { /* SEGMENT BOTH */
+        if (!URI_FUNC(PushPathSegment)(
+                    state, first, afterSegmentNz, memory)) { /* SEGMENT BOTH */
             URI_FUNC(StopMalloc)(state, memory);
             return NULL;
         }
@@ -1296,16 +1200,16 @@ URI_FUNC(ParsePathAbsNoLeadSlash)(URI_TYPE(ParserState) * state, const URI_CHAR
 /*
  * [pathRootless]->[segmentNz][zeroMoreSlashSegs]
  */
-static URI_INLINE const URI_CHAR *
-URI_FUNC(ParsePathRootless)(URI_TYPE(ParserState) * state, const URI_CHAR * first,
-                            const URI_CHAR * afterLast, UriMemoryManager * memory) {
+static URI_INLINE const URI_CHAR * URI_FUNC(ParsePathRootless)(
+        URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast,
+        UriMemoryManager * memory) {
     const URI_CHAR * const afterSegmentNz =
-        URI_FUNC(ParseSegmentNz)(state, first, afterLast, memory);
+            URI_FUNC(ParseSegmentNz)(state, first, afterLast, memory);
     if (afterSegmentNz == NULL) {
         return NULL;
     } else {
-        if (!URI_FUNC(PushPathSegment)(state, first, afterSegmentNz,
-                                       memory)) { /* SEGMENT BOTH */
+        if (!URI_FUNC(PushPathSegment)(
+                    state, first, afterSegmentNz, memory)) { /* SEGMENT BOTH */
             URI_FUNC(StopMalloc)(state, memory);
             return NULL;
         }
@@ -1321,9 +1225,7 @@ URI_FUNC(ParsePathRootless)(URI_TYPE(ParserState) * state, const URI_CHAR * firs
  * [pchar]-><@>
  */
 static const URI_CHAR * URI_FUNC(ParsePchar)(URI_TYPE(ParserState) * state,
-                                             const URI_CHAR * first,
-                                             const URI_CHAR * afterLast,
-                                             UriMemoryManager * memory) {
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory) {
     if (first >= afterLast) {
         URI_FUNC(StopSyntax)(state, afterLast, memory);
         return NULL;
@@ -1346,9 +1248,7 @@ static const URI_CHAR * URI_FUNC(ParsePchar)(URI_TYPE(ParserState) * state,
  * [pctEncoded]-><%>[HEXDIG][HEXDIG]
  */
 static const URI_CHAR * URI_FUNC(ParsePctEncoded)(URI_TYPE(ParserState) * state,
-                                                  const URI_CHAR * first,
-                                                  const URI_CHAR * afterLast,
-                                                  UriMemoryManager * memory) {
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory) {
     if (first >= afterLast) {
         URI_FUNC(StopSyntax)(state, afterLast, memory);
         return NULL;
@@ -1401,9 +1301,7 @@ static const URI_CHAR * URI_FUNC(ParsePctEncoded)(URI_TYPE(ParserState) * state,
  * [pctSubUnres]->[unreserved]
  */
 static const URI_CHAR * URI_FUNC(ParsePctSubUnres)(URI_TYPE(ParserState) * state,
-                                                   const URI_CHAR * first,
-                                                   const URI_CHAR * afterLast,
-                                                   UriMemoryManager * memory) {
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory) {
     if (first >= afterLast) {
         URI_FUNC(StopSyntax)(state, afterLast, memory);
         return NULL;
@@ -1427,8 +1325,8 @@ static const URI_CHAR * URI_FUNC(ParsePctSubUnres)(URI_TYPE(ParserState) * state
  * [port]->[DIGIT][port]
  * [port]-><NULL>
  */
-static const URI_CHAR * URI_FUNC(ParsePort)(const URI_CHAR * first,
-                                            const URI_CHAR * afterLast) {
+static const URI_CHAR * URI_FUNC(ParsePort)(
+        const URI_CHAR * first, const URI_CHAR * afterLast) {
 tail_call:
     if (first >= afterLast) {
         return afterLast;
@@ -1451,9 +1349,7 @@ static const URI_CHAR * URI_FUNC(ParsePort)(const URI_CHAR * first,
  * [queryFrag]-><NULL>
  */
 static const URI_CHAR * URI_FUNC(ParseQueryFrag)(URI_TYPE(ParserState) * state,
-                                                 const URI_CHAR * first,
-                                                 const URI_CHAR * afterLast,
-                                                 UriMemoryManager * memory) {
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory) {
 tail_call:
     if (first >= afterLast) {
         return afterLast;
@@ -1462,7 +1358,7 @@ static const URI_CHAR * URI_FUNC(ParseQueryFrag)(URI_TYPE(ParserState) * state,
     switch (*first) {
     case URI_SET_PCHAR(_UT): {
         const URI_CHAR * const afterPchar =
-            URI_FUNC(ParsePchar)(state, first, afterLast, memory);
+                URI_FUNC(ParsePchar)(state, first, afterLast, memory);
         if (afterPchar == NULL) {
             return NULL;
         }
@@ -1485,9 +1381,7 @@ static const URI_CHAR * URI_FUNC(ParseQueryFrag)(URI_TYPE(ParserState) * state,
  * [segment]-><NULL>
  */
 static const URI_CHAR * URI_FUNC(ParseSegment)(URI_TYPE(ParserState) * state,
-                                               const URI_CHAR * first,
-                                               const URI_CHAR * afterLast,
-                                               UriMemoryManager * memory) {
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory) {
 tail_call:
     if (first >= afterLast) {
         return afterLast;
@@ -1496,7 +1390,7 @@ static const URI_CHAR * URI_FUNC(ParseSegment)(URI_TYPE(ParserState) * state,
     switch (*first) {
     case URI_SET_PCHAR(_UT): {
         const URI_CHAR * const afterPchar =
-            URI_FUNC(ParsePchar)(state, first, afterLast, memory);
+                URI_FUNC(ParsePchar)(state, first, afterLast, memory);
         if (afterPchar == NULL) {
             return NULL;
         }
@@ -1513,11 +1407,9 @@ static const URI_CHAR * URI_FUNC(ParseSegment)(URI_TYPE(ParserState) * state,
  * [segmentNz]->[pchar][segment]
  */
 static URI_INLINE const URI_CHAR * URI_FUNC(ParseSegmentNz)(URI_TYPE(ParserState) * state,
-                                                            const URI_CHAR * first,
-                                                            const URI_CHAR * afterLast,
-                                                            UriMemoryManager * memory) {
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory) {
     const URI_CHAR * const afterPchar =
-        URI_FUNC(ParsePchar)(state, first, afterLast, memory);
+            URI_FUNC(ParsePchar)(state, first, afterLast, memory);
     if (afterPchar == NULL) {
         return NULL;
     }
@@ -1525,9 +1417,10 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseSegmentNz)(URI_TYPE(ParserState
 }

 static URI_INLINE UriBool URI_FUNC(OnExitSegmentNzNcOrScheme2)(
-    URI_TYPE(ParserState) * state, const URI_CHAR * first, UriMemoryManager * memory) {
-    if (!URI_FUNC(PushPathSegment)(state, state->uri->scheme.first, first,
-                                   memory)) { /* SEGMENT BOTH */
+        URI_TYPE(ParserState) * state, const URI_CHAR * first,
+        UriMemoryManager * memory) {
+    if (!URI_FUNC(PushPathSegment)(
+                state, state->uri->scheme.first, first, memory)) { /* SEGMENT BOTH */
         return URI_FALSE; /* Raises malloc error*/
     }
     state->uri->scheme.first = NULL; /* Not a scheme, reset */
@@ -1559,9 +1452,7 @@ static URI_INLINE UriBool URI_FUNC(OnExitSegmentNzNcOrScheme2)(
  * [segmentNzNcOrScheme2]-><->[segmentNzNcOrScheme2]
  */
 static const URI_CHAR * URI_FUNC(ParseSegmentNzNcOrScheme2)(URI_TYPE(ParserState) * state,
-                                                            const URI_CHAR * first,
-                                                            const URI_CHAR * afterLast,
-                                                            UriMemoryManager * memory) {
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory) {
 tail_call:
     if (first >= afterLast) {
         if (!URI_FUNC(OnExitSegmentNzNcOrScheme2)(state, first, memory)) {
@@ -1582,12 +1473,12 @@ static const URI_CHAR * URI_FUNC(ParseSegmentNzNcOrScheme2)(URI_TYPE(ParserState

     case _UT('%'): {
         const URI_CHAR * const afterPctEncoded =
-            URI_FUNC(ParsePctEncoded)(state, first, afterLast, memory);
+                URI_FUNC(ParsePctEncoded)(state, first, afterLast, memory);
         if (afterPctEncoded == NULL) {
             return NULL;
         }
-        return URI_FUNC(ParseMustBeSegmentNzNc)(state, afterPctEncoded, afterLast,
-                                                memory);
+        return URI_FUNC(ParseMustBeSegmentNzNc)(
+                state, afterPctEncoded, afterLast, memory);
     }

     case _UT('!'):
@@ -1608,23 +1499,23 @@ static const URI_CHAR * URI_FUNC(ParseSegmentNzNcOrScheme2)(URI_TYPE(ParserState
     case _UT('/'): {
         const URI_CHAR * afterZeroMoreSlashSegs;
         const URI_CHAR * const afterSegment =
-            URI_FUNC(ParseSegment)(state, first + 1, afterLast, memory);
+                URI_FUNC(ParseSegment)(state, first + 1, afterLast, memory);
         if (afterSegment == NULL) {
             return NULL;
         }
-        if (!URI_FUNC(PushPathSegment)(state, state->uri->scheme.first, first,
-                                       memory)) { /* SEGMENT BOTH */
+        if (!URI_FUNC(PushPathSegment)(
+                    state, state->uri->scheme.first, first, memory)) { /* SEGMENT BOTH */
             URI_FUNC(StopMalloc)(state, memory);
             return NULL;
         }
         state->uri->scheme.first = NULL; /* Not a scheme, reset */
-        if (!URI_FUNC(PushPathSegment)(state, first + 1, afterSegment,
-                                       memory)) { /* SEGMENT BOTH */
+        if (!URI_FUNC(PushPathSegment)(
+                    state, first + 1, afterSegment, memory)) { /* SEGMENT BOTH */
             URI_FUNC(StopMalloc)(state, memory);
             return NULL;
         }
         afterZeroMoreSlashSegs =
-            URI_FUNC(ParseZeroMoreSlashSegs)(state, afterSegment, afterLast, memory);
+                URI_FUNC(ParseZeroMoreSlashSegs)(state, afterSegment, afterLast, memory);
         if (afterZeroMoreSlashSegs == NULL) {
             return NULL;
         }
@@ -1633,7 +1524,7 @@ static const URI_CHAR * URI_FUNC(ParseSegmentNzNcOrScheme2)(URI_TYPE(ParserState

     case _UT(':'): {
         const URI_CHAR * const afterHierPart =
-            URI_FUNC(ParseHierPart)(state, first + 1, afterLast, memory);
+                URI_FUNC(ParseHierPart)(state, first + 1, afterLast, memory);
         state->uri->scheme.afterLast = first; /* SCHEME END */
         if (afterHierPart == NULL) {
             return NULL;
@@ -1664,9 +1555,7 @@ static const URI_CHAR * URI_FUNC(ParseSegmentNzNcOrScheme2)(URI_TYPE(ParserState
  * [uriReference]-><->[mustBeSegmentNzNc]
  */
 static const URI_CHAR * URI_FUNC(ParseUriReference)(URI_TYPE(ParserState) * state,
-                                                    const URI_CHAR * first,
-                                                    const URI_CHAR * afterLast,
-                                                    UriMemoryManager * memory) {
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory) {
     if (first >= afterLast) {
         return afterLast;
     }
@@ -1688,18 +1577,18 @@ static const URI_CHAR * URI_FUNC(ParseUriReference)(URI_TYPE(ParserState) * stat

     case _UT('%'): {
         const URI_CHAR * const afterPctEncoded =
-            URI_FUNC(ParsePctEncoded)(state, first, afterLast, memory);
+                URI_FUNC(ParsePctEncoded)(state, first, afterLast, memory);
         if (afterPctEncoded == NULL) {
             return NULL;
         }
         state->uri->scheme.first = first; /* SEGMENT BEGIN, ABUSE SCHEME POINTER */
-        return URI_FUNC(ParseMustBeSegmentNzNc)(state, afterPctEncoded, afterLast,
-                                                memory);
+        return URI_FUNC(ParseMustBeSegmentNzNc)(
+                state, afterPctEncoded, afterLast, memory);
     }

     case _UT('/'): {
         const URI_CHAR * const afterPartHelperTwo =
-            URI_FUNC(ParsePartHelperTwo)(state, first + 1, afterLast, memory);
+                URI_FUNC(ParsePartHelperTwo)(state, first + 1, afterLast, memory);
         if (afterPartHelperTwo == NULL) {
             return NULL;
         }
@@ -1717,9 +1606,7 @@ static const URI_CHAR * URI_FUNC(ParseUriReference)(URI_TYPE(ParserState) * stat
  * [uriTail]-><NULL>
  */
 static URI_INLINE const URI_CHAR * URI_FUNC(ParseUriTail)(URI_TYPE(ParserState) * state,
-                                                          const URI_CHAR * first,
-                                                          const URI_CHAR * afterLast,
-                                                          UriMemoryManager * memory) {
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory) {
     if (first >= afterLast) {
         return afterLast;
     }
@@ -1727,7 +1614,7 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseUriTail)(URI_TYPE(ParserState)
     switch (*first) {
     case _UT('#'): {
         const URI_CHAR * const afterQueryFrag =
-            URI_FUNC(ParseQueryFrag)(state, first + 1, afterLast, memory);
+                URI_FUNC(ParseQueryFrag)(state, first + 1, afterLast, memory);
         if (afterQueryFrag == NULL) {
             return NULL;
         }
@@ -1738,7 +1625,7 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseUriTail)(URI_TYPE(ParserState)

     case _UT('?'): {
         const URI_CHAR * const afterQueryFrag =
-            URI_FUNC(ParseQueryFrag)(state, first + 1, afterLast, memory);
+                URI_FUNC(ParseQueryFrag)(state, first + 1, afterLast, memory);
         if (afterQueryFrag == NULL) {
             return NULL;
         }
@@ -1756,9 +1643,9 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseUriTail)(URI_TYPE(ParserState)
  * [uriTailTwo]-><#>[queryFrag]
  * [uriTailTwo]-><NULL>
  */
-static URI_INLINE const URI_CHAR *
-URI_FUNC(ParseUriTailTwo)(URI_TYPE(ParserState) * state, const URI_CHAR * first,
-                          const URI_CHAR * afterLast, UriMemoryManager * memory) {
+static URI_INLINE const URI_CHAR * URI_FUNC(ParseUriTailTwo)(
+        URI_TYPE(ParserState) * state, const URI_CHAR * first, const URI_CHAR * afterLast,
+        UriMemoryManager * memory) {
     if (first >= afterLast) {
         return afterLast;
     }
@@ -1766,7 +1653,7 @@ URI_FUNC(ParseUriTailTwo)(URI_TYPE(ParserState) * state, const URI_CHAR * first,
     switch (*first) {
     case _UT('#'): {
         const URI_CHAR * const afterQueryFrag =
-            URI_FUNC(ParseQueryFrag)(state, first + 1, afterLast, memory);
+                URI_FUNC(ParseQueryFrag)(state, first + 1, afterLast, memory);
         if (afterQueryFrag == NULL) {
             return NULL;
         }
@@ -1785,9 +1672,7 @@ URI_FUNC(ParseUriTailTwo)(URI_TYPE(ParserState) * state, const URI_CHAR * first,
  * [zeroMoreSlashSegs]-><NULL>
  */
 static const URI_CHAR * URI_FUNC(ParseZeroMoreSlashSegs)(URI_TYPE(ParserState) * state,
-                                                         const URI_CHAR * first,
-                                                         const URI_CHAR * afterLast,
-                                                         UriMemoryManager * memory) {
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory) {
 tail_call:
     if (first >= afterLast) {
         return afterLast;
@@ -1796,12 +1681,12 @@ static const URI_CHAR * URI_FUNC(ParseZeroMoreSlashSegs)(URI_TYPE(ParserState) *
     switch (*first) {
     case _UT('/'): {
         const URI_CHAR * const afterSegment =
-            URI_FUNC(ParseSegment)(state, first + 1, afterLast, memory);
+                URI_FUNC(ParseSegment)(state, first + 1, afterLast, memory);
         if (afterSegment == NULL) {
             return NULL;
         }
-        if (!URI_FUNC(PushPathSegment)(state, first + 1, afterSegment,
-                                       memory)) { /* SEGMENT BOTH */
+        if (!URI_FUNC(PushPathSegment)(
+                    state, first + 1, afterSegment, memory)) { /* SEGMENT BOTH */
             URI_FUNC(StopMalloc)(state, memory);
             return NULL;
         }
@@ -1814,19 +1699,17 @@ static const URI_CHAR * URI_FUNC(ParseZeroMoreSlashSegs)(URI_TYPE(ParserState) *
     }
 }

-static URI_INLINE void URI_FUNC(ResetParserStateExceptUri)(URI_TYPE(ParserState)
-                                                           * state) {
+static URI_INLINE void URI_FUNC(ResetParserStateExceptUri)(
+        URI_TYPE(ParserState) * state) {
     URI_TYPE(Uri) * const uriBackup = state->uri;
     memset(state, 0, sizeof(URI_TYPE(ParserState)));
     state->uri = uriBackup;
 }

 static URI_INLINE UriBool URI_FUNC(PushPathSegment)(URI_TYPE(ParserState) * state,
-                                                    const URI_CHAR * first,
-                                                    const URI_CHAR * afterLast,
-                                                    UriMemoryManager * memory) {
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory) {
     URI_TYPE(PathSegment) * segment =
-        memory->calloc(memory, 1, sizeof(URI_TYPE(PathSegment)));
+            memory->calloc(memory, 1, sizeof(URI_TYPE(PathSegment)));
     if (segment == NULL) {
         return URI_FALSE; /* Raises malloc error */
     }
@@ -1853,12 +1736,12 @@ static URI_INLINE UriBool URI_FUNC(PushPathSegment)(URI_TYPE(ParserState) * stat
 }

 int URI_FUNC(ParseUriEx)(URI_TYPE(ParserState) * state, const URI_CHAR * first,
-                         const URI_CHAR * afterLast) {
+        const URI_CHAR * afterLast) {
     return URI_FUNC(ParseUriExMm)(state, first, afterLast, NULL);
 }

 static int URI_FUNC(ParseUriExMm)(URI_TYPE(ParserState) * state, const URI_CHAR * first,
-                                  const URI_CHAR * afterLast, UriMemoryManager * memory) {
+        const URI_CHAR * afterLast, UriMemoryManager * memory) {
     const URI_CHAR * afterUriReference;
     URI_TYPE(Uri) * uri;

@@ -1901,13 +1784,13 @@ int URI_FUNC(ParseUri)(URI_TYPE(ParserState) * state, const URI_CHAR * text) {
     return URI_FUNC(ParseUriEx)(state, text, text + URI_STRLEN(text));
 }

-int URI_FUNC(ParseSingleUri)(URI_TYPE(Uri) * uri, const URI_CHAR * text,
-                             const URI_CHAR ** errorPos) {
+int URI_FUNC(ParseSingleUri)(
+        URI_TYPE(Uri) * uri, const URI_CHAR * text, const URI_CHAR ** errorPos) {
     return URI_FUNC(ParseSingleUriEx)(uri, text, NULL, errorPos);
 }

 int URI_FUNC(ParseSingleUriEx)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                               const URI_CHAR * afterLast, const URI_CHAR ** errorPos) {
+        const URI_CHAR * afterLast, const URI_CHAR ** errorPos) {
     if ((afterLast == NULL) && (first != NULL)) {
         afterLast = first + URI_STRLEN(first);
     }
@@ -1915,8 +1798,8 @@ int URI_FUNC(ParseSingleUriEx)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
 }

 int URI_FUNC(ParseSingleUriExMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                                 const URI_CHAR * afterLast, const URI_CHAR ** errorPos,
-                                 UriMemoryManager * memory) {
+        const URI_CHAR * afterLast, const URI_CHAR ** errorPos,
+        UriMemoryManager * memory) {
     URI_TYPE(ParserState) state;
     int res;

diff --git a/ext/uri/uriparser/src/UriParseBase.c b/ext/uri/uriparser/src/UriParseBase.c
index 0ee66d4427e..010e3032643 100644
--- a/ext/uri/uriparser/src/UriParseBase.c
+++ b/ext/uri/uriparser/src/UriParseBase.c
@@ -41,8 +41,8 @@
 #  include "UriParseBase.h"
 #endif

-void uriWriteQuadToDoubleByte(const unsigned char * hexDigits, int digitCount,
-                              unsigned char * output) {
+void uriWriteQuadToDoubleByte(
+        const unsigned char * hexDigits, int digitCount, unsigned char * output) {
     switch (digitCount) {
     case 1:
         /* 0x___? -> \x00 \x0? */
diff --git a/ext/uri/uriparser/src/UriParseBase.h b/ext/uri/uriparser/src/UriParseBase.h
index cdb2c6f7787..e139c719938 100644
--- a/ext/uri/uriparser/src/UriParseBase.h
+++ b/ext/uri/uriparser/src/UriParseBase.h
@@ -42,8 +42,8 @@

 #  include <uriparser/UriBase.h>

-void uriWriteQuadToDoubleByte(const unsigned char * hexDigits, int digitCount,
-                              unsigned char * output);
+void uriWriteQuadToDoubleByte(
+        const unsigned char * hexDigits, int digitCount, unsigned char * output);
 unsigned char uriGetOctetValue(const unsigned char * digits, int digitCount);

 #endif /* URI_PARSE_BASE_H */
diff --git a/ext/uri/uriparser/src/UriQuery.c b/ext/uri/uriparser/src/UriQuery.c
index de3a040de04..b895c48ad61 100644
--- a/ext/uri/uriparser/src/UriQuery.c
+++ b/ext/uri/uriparser/src/UriQuery.c
@@ -70,48 +70,44 @@
 #  include <stdint.h>  // SIZE_MAX

 static int URI_FUNC(ComposeQueryEngine)(URI_CHAR * dest,
-                                        const URI_TYPE(QueryList) * queryList,
-                                        int maxChars, int * charsWritten,
-                                        int * charsRequired, UriBool spaceToPlus,
-                                        UriBool normalizeBreaks);
-
-static UriBool URI_FUNC(AppendQueryItem)(
-    URI_TYPE(QueryList) * *prevNext, int * itemCount, const URI_CHAR * keyFirst,
-    const URI_CHAR * keyAfter, const URI_CHAR * valueFirst, const URI_CHAR * valueAfter,
-    UriBool plusToSpace, UriBreakConversion breakConversion, UriMemoryManager * memory);
-
-int URI_FUNC(ComposeQueryCharsRequired)(const URI_TYPE(QueryList) * queryList,
-                                        int * charsRequired) {
+        const URI_TYPE(QueryList) * queryList, int maxChars, int * charsWritten,
+        int * charsRequired, UriBool spaceToPlus, UriBool normalizeBreaks);
+
+static UriBool URI_FUNC(AppendQueryItem)(URI_TYPE(QueryList) * *prevNext, int * itemCount,
+        const URI_CHAR * keyFirst, const URI_CHAR * keyAfter, const URI_CHAR * valueFirst,
+        const URI_CHAR * valueAfter, UriBool plusToSpace,
+        UriBreakConversion breakConversion, UriMemoryManager * memory);
+
+int URI_FUNC(ComposeQueryCharsRequired)(
+        const URI_TYPE(QueryList) * queryList, int * charsRequired) {
     const UriBool spaceToPlus = URI_TRUE;
     const UriBool normalizeBreaks = URI_TRUE;

-    return URI_FUNC(ComposeQueryCharsRequiredEx)(queryList, charsRequired, spaceToPlus,
-                                                 normalizeBreaks);
+    return URI_FUNC(ComposeQueryCharsRequiredEx)(
+            queryList, charsRequired, spaceToPlus, normalizeBreaks);
 }

 int URI_FUNC(ComposeQueryCharsRequiredEx)(const URI_TYPE(QueryList) * queryList,
-                                          int * charsRequired, UriBool spaceToPlus,
-                                          UriBool normalizeBreaks) {
+        int * charsRequired, UriBool spaceToPlus, UriBool normalizeBreaks) {
     if ((queryList == NULL) || (charsRequired == NULL)) {
         return URI_ERROR_NULL;
     }

-    return URI_FUNC(ComposeQueryEngine)(NULL, queryList, 0, NULL, charsRequired,
-                                        spaceToPlus, normalizeBreaks);
+    return URI_FUNC(ComposeQueryEngine)(
+            NULL, queryList, 0, NULL, charsRequired, spaceToPlus, normalizeBreaks);
 }

 int URI_FUNC(ComposeQuery)(URI_CHAR * dest, const URI_TYPE(QueryList) * queryList,
-                           int maxChars, int * charsWritten) {
+        int maxChars, int * charsWritten) {
     const UriBool spaceToPlus = URI_TRUE;
     const UriBool normalizeBreaks = URI_TRUE;

-    return URI_FUNC(ComposeQueryEx)(dest, queryList, maxChars, charsWritten, spaceToPlus,
-                                    normalizeBreaks);
+    return URI_FUNC(ComposeQueryEx)(
+            dest, queryList, maxChars, charsWritten, spaceToPlus, normalizeBreaks);
 }

 int URI_FUNC(ComposeQueryEx)(URI_CHAR * dest, const URI_TYPE(QueryList) * queryList,
-                             int maxChars, int * charsWritten, UriBool spaceToPlus,
-                             UriBool normalizeBreaks) {
+        int maxChars, int * charsWritten, UriBool spaceToPlus, UriBool normalizeBreaks) {
     if ((dest == NULL) || (queryList == NULL)) {
         return URI_ERROR_NULL;
     }
@@ -120,12 +116,12 @@ int URI_FUNC(ComposeQueryEx)(URI_CHAR * dest, const URI_TYPE(QueryList) * queryL
         return URI_ERROR_OUTPUT_TOO_LARGE;
     }

-    return URI_FUNC(ComposeQueryEngine)(dest, queryList, maxChars, charsWritten, NULL,
-                                        spaceToPlus, normalizeBreaks);
+    return URI_FUNC(ComposeQueryEngine)(
+            dest, queryList, maxChars, charsWritten, NULL, spaceToPlus, normalizeBreaks);
 }

-int URI_FUNC(ComposeQueryMalloc)(URI_CHAR ** dest,
-                                 const URI_TYPE(QueryList) * queryList) {
+int URI_FUNC(ComposeQueryMalloc)(
+        URI_CHAR ** dest, const URI_TYPE(QueryList) * queryList) {
     const UriBool spaceToPlus = URI_TRUE;
     const UriBool normalizeBreaks = URI_TRUE;

@@ -133,16 +129,15 @@ int URI_FUNC(ComposeQueryMalloc)(URI_CHAR ** dest,
 }

 int URI_FUNC(ComposeQueryMallocEx)(URI_CHAR ** dest,
-                                   const URI_TYPE(QueryList) * queryList,
-                                   UriBool spaceToPlus, UriBool normalizeBreaks) {
-    return URI_FUNC(ComposeQueryMallocExMm)(dest, queryList, spaceToPlus, normalizeBreaks,
-                                            NULL);
+        const URI_TYPE(QueryList) * queryList, UriBool spaceToPlus,
+        UriBool normalizeBreaks) {
+    return URI_FUNC(ComposeQueryMallocExMm)(
+            dest, queryList, spaceToPlus, normalizeBreaks, NULL);
 }

 int URI_FUNC(ComposeQueryMallocExMm)(URI_CHAR ** dest,
-                                     const URI_TYPE(QueryList) * queryList,
-                                     UriBool spaceToPlus, UriBool normalizeBreaks,
-                                     UriMemoryManager * memory) {
+        const URI_TYPE(QueryList) * queryList, UriBool spaceToPlus,
+        UriBool normalizeBreaks, UriMemoryManager * memory) {
     int charsRequired;
     int res;
     URI_CHAR * queryString;
@@ -154,8 +149,8 @@ int URI_FUNC(ComposeQueryMallocExMm)(URI_CHAR ** dest,
     URI_CHECK_MEMORY_MANAGER(memory); /* may return */

     /* Calculate space */
-    res = URI_FUNC(ComposeQueryCharsRequiredEx)(queryList, &charsRequired, spaceToPlus,
-                                                normalizeBreaks);
+    res = URI_FUNC(ComposeQueryCharsRequiredEx)(
+            queryList, &charsRequired, spaceToPlus, normalizeBreaks);
     if (res != URI_SUCCESS) {
         return res;
     }
@@ -171,8 +166,8 @@ int URI_FUNC(ComposeQueryMallocExMm)(URI_CHAR ** dest,
     }

     /* Put query in */
-    res = URI_FUNC(ComposeQueryEx)(queryString, queryList, charsRequired, NULL,
-                                   spaceToPlus, normalizeBreaks);
+    res = URI_FUNC(ComposeQueryEx)(
+            queryString, queryList, charsRequired, NULL, spaceToPlus, normalizeBreaks);
     if (res != URI_SUCCESS) {
         memory->free(memory, queryString);
         return res;
@@ -183,8 +178,8 @@ int URI_FUNC(ComposeQueryMallocExMm)(URI_CHAR ** dest,
 }

 int URI_FUNC(ComposeQueryEngine)(URI_CHAR * dest, const URI_TYPE(QueryList) * queryList,
-                                 int maxChars, int * charsWritten, int * charsRequired,
-                                 UriBool spaceToPlus, UriBool normalizeBreaks) {
+        int maxChars, int * charsWritten, int * charsRequired, UriBool spaceToPlus,
+        UriBool normalizeBreaks) {
     UriBool firstItem = URI_TRUE;
     int ampersandLen = 0; /* increased to 1 from second item on */
     URI_CHAR * write = dest;
@@ -206,15 +201,25 @@ int URI_FUNC(ComposeQueryEngine)(URI_CHAR * dest, const URI_TYPE(QueryList) * qu
         int valueRequiredChars;

         if ((keyLen >= (size_t)INT_MAX / worstCase)
-            || (valueLen >= (size_t)INT_MAX / worstCase)) {
+                || (valueLen >= (size_t)INT_MAX / worstCase)) {
             return URI_ERROR_OUTPUT_TOO_LARGE;
         }
         keyRequiredChars = worstCase * (int)keyLen;
         valueRequiredChars = worstCase * (int)valueLen;

         if (dest == NULL) {
-            (*charsRequired) += ampersandLen + keyRequiredChars
-                                + ((value == NULL) ? 0 : 1 + valueRequiredChars);
+            const int equalSignLen = (value == NULL) ? 0 : 1;
+
+            // Detect and avoid integer overflow
+            if (ampersandLen > INT_MAX - keyRequiredChars
+                    || ampersandLen + keyRequiredChars > INT_MAX - equalSignLen
+                    || ampersandLen + keyRequiredChars + equalSignLen
+                               > INT_MAX - valueRequiredChars) {
+                return URI_ERROR_OUTPUT_TOO_LARGE;
+            }
+
+            (*charsRequired) +=
+                    ampersandLen + keyRequiredChars + equalSignLen + valueRequiredChars;

             if (firstItem == URI_TRUE) {
                 ampersandLen = 1;
@@ -233,8 +238,8 @@ int URI_FUNC(ComposeQueryEngine)(URI_CHAR * dest, const URI_TYPE(QueryList) * qu
                 write[0] = _UT('&');
                 write++;
             }
-            write = URI_FUNC(EscapeEx)(key, key + keyLen, write, spaceToPlus,
-                                       normalizeBreaks);
+            write = URI_FUNC(EscapeEx)(
+                    key, key + keyLen, write, spaceToPlus, normalizeBreaks);

             if (value != NULL) {
                 if ((write - dest) + 1 + valueRequiredChars > maxChars) {
@@ -244,8 +249,8 @@ int URI_FUNC(ComposeQueryEngine)(URI_CHAR * dest, const URI_TYPE(QueryList) * qu
                 /* Copy value */
                 write[0] = _UT('=');
                 write++;
-                write = URI_FUNC(EscapeEx)(value, value + valueLen, write, spaceToPlus,
-                                           normalizeBreaks);
+                write = URI_FUNC(EscapeEx)(
+                        value, value + valueLen, write, spaceToPlus, normalizeBreaks);
             }
         }

@@ -270,22 +275,26 @@ int URI_FUNC(ComposeQueryEngine)(URI_CHAR * dest, const URI_TYPE(QueryList) * qu
 }

 UriBool URI_FUNC(AppendQueryItem)(URI_TYPE(QueryList) * *prevNext, int * itemCount,
-                                  const URI_CHAR * keyFirst, const URI_CHAR * keyAfter,
-                                  const URI_CHAR * valueFirst,
-                                  const URI_CHAR * valueAfter, UriBool plusToSpace,
-                                  UriBreakConversion breakConversion,
-                                  UriMemoryManager * memory) {
+        const URI_CHAR * keyFirst, const URI_CHAR * keyAfter, const URI_CHAR * valueFirst,
+        const URI_CHAR * valueAfter, UriBool plusToSpace,
+        UriBreakConversion breakConversion, UriMemoryManager * memory) {
     const size_t keyLen = keyAfter - keyFirst;
     const size_t valueLen = valueAfter - valueFirst;
     URI_CHAR * key;
     URI_CHAR * value;

     if ((prevNext == NULL) || (itemCount == NULL) || (keyFirst == NULL)
-        || (keyAfter == NULL) || (keyFirst > keyAfter) || (valueFirst > valueAfter)
-        || ((keyFirst == keyAfter) && (valueFirst == NULL) && (valueAfter == NULL))) {
+            || (keyAfter == NULL) || (keyFirst > keyAfter) || (valueFirst > valueAfter)
+            || ((keyFirst == keyAfter) && (valueFirst == NULL) && (valueAfter == NULL))) {
         return URI_TRUE;
     }

+    // Detect integer overflow
+    // (since we will add 1 to it near the end of the function)
+    if (*itemCount == INT_MAX) {
+        return URI_FALSE; /* Raises malloc error */
+    }
+
     /* Append new empty item */
     *prevNext = memory->malloc(memory, 1 * sizeof(URI_TYPE(QueryList)));
     if (*prevNext == NULL) {
@@ -358,8 +367,8 @@ void URI_FUNC(FreeQueryList)(URI_TYPE(QueryList) * queryList) {
     URI_FUNC(FreeQueryListMm)(queryList, NULL);
 }

-int URI_FUNC(FreeQueryListMm)(URI_TYPE(QueryList) * queryList,
-                              UriMemoryManager * memory) {
+int URI_FUNC(FreeQueryListMm)(
+        URI_TYPE(QueryList) * queryList, UriMemoryManager * memory) {
     URI_CHECK_MEMORY_MANAGER(memory); /* may return */
     while (queryList != NULL) {
         URI_TYPE(QueryList) * nextBackup = queryList->next;
@@ -372,27 +381,24 @@ int URI_FUNC(FreeQueryListMm)(URI_TYPE(QueryList) * queryList,
 }

 int URI_FUNC(DissectQueryMalloc)(URI_TYPE(QueryList) * *dest, int * itemCount,
-                                 const URI_CHAR * first, const URI_CHAR * afterLast) {
+        const URI_CHAR * first, const URI_CHAR * afterLast) {
     const UriBool plusToSpace = URI_TRUE;
     const UriBreakConversion breakConversion = URI_BR_DONT_TOUCH;

-    return URI_FUNC(DissectQueryMallocEx)(dest, itemCount, first, afterLast, plusToSpace,
-                                          breakConversion);
+    return URI_FUNC(DissectQueryMallocEx)(
+            dest, itemCount, first, afterLast, plusToSpace, breakConversion);
 }

 int URI_FUNC(DissectQueryMallocEx)(URI_TYPE(QueryList) * *dest, int * itemCount,
-                                   const URI_CHAR * first, const URI_CHAR * afterLast,
-                                   UriBool plusToSpace,
-                                   UriBreakConversion breakConversion) {
-    return URI_FUNC(DissectQueryMallocExMm)(dest, itemCount, first, afterLast,
-                                            plusToSpace, breakConversion, NULL);
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriBool plusToSpace,
+        UriBreakConversion breakConversion) {
+    return URI_FUNC(DissectQueryMallocExMm)(
+            dest, itemCount, first, afterLast, plusToSpace, breakConversion, NULL);
 }

 int URI_FUNC(DissectQueryMallocExMm)(URI_TYPE(QueryList) * *dest, int * itemCount,
-                                     const URI_CHAR * first, const URI_CHAR * afterLast,
-                                     UriBool plusToSpace,
-                                     UriBreakConversion breakConversion,
-                                     UriMemoryManager * memory) {
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriBool plusToSpace,
+        UriBreakConversion breakConversion, UriMemoryManager * memory) {
     const URI_CHAR * walk = first;
     const URI_CHAR * keyFirst = first;
     const URI_CHAR * keyAfter = NULL;
@@ -426,9 +432,8 @@ int URI_FUNC(DissectQueryMallocExMm)(URI_TYPE(QueryList) * *dest, int * itemCoun
             }

             if (URI_FUNC(AppendQueryItem)(prevNext, itemsAppended, keyFirst, keyAfter,
-                                          valueFirst, valueAfter, plusToSpace,
-                                          breakConversion, memory)
-                == URI_FALSE) {
+                        valueFirst, valueAfter, plusToSpace, breakConversion, memory)
+                    == URI_FALSE) {
                 /* Free list we built */
                 *itemsAppended = 0;
                 URI_FUNC(FreeQueryListMm)(*dest, memory);
@@ -476,8 +481,8 @@ int URI_FUNC(DissectQueryMallocExMm)(URI_TYPE(QueryList) * *dest, int * itemCoun
     }

     if (URI_FUNC(AppendQueryItem)(prevNext, itemsAppended, keyFirst, keyAfter, valueFirst,
-                                  valueAfter, plusToSpace, breakConversion, memory)
-        == URI_FALSE) {
+                valueAfter, plusToSpace, breakConversion, memory)
+            == URI_FALSE) {
         /* Free list we built */
         *itemsAppended = 0;
         URI_FUNC(FreeQueryListMm)(*dest, memory);
diff --git a/ext/uri/uriparser/src/UriRecompose.c b/ext/uri/uriparser/src/UriRecompose.c
index 055e0483d3f..ddddbe46bb1 100644
--- a/ext/uri/uriparser/src/UriRecompose.c
+++ b/ext/uri/uriparser/src/UriRecompose.c
@@ -68,22 +68,20 @@
 #  include <stdint.h>  // SIZE_MAX

 static int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(Uri) * uri,
-                                    int maxChars, int * charsWritten,
-                                    int * charsRequired);
+        int maxChars, int * charsWritten, int * charsRequired);

 int URI_FUNC(ToStringCharsRequired)(const URI_TYPE(Uri) * uri, int * charsRequired) {
     const int MAX_CHARS = ((unsigned int)-1) >> 1;
     return URI_FUNC(ToStringEngine)(NULL, uri, MAX_CHARS, NULL, charsRequired);
 }

-int URI_FUNC(ToString)(URI_CHAR * dest, const URI_TYPE(Uri) * uri, int maxChars,
-                       int * charsWritten) {
+int URI_FUNC(ToString)(
+        URI_CHAR * dest, const URI_TYPE(Uri) * uri, int maxChars, int * charsWritten) {
     return URI_FUNC(ToStringEngine)(dest, uri, maxChars, charsWritten, NULL);
 }

 static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(Uri) * uri,
-                                               int maxChars, int * charsWritten,
-                                               int * charsRequired) {
+        int maxChars, int * charsWritten, int * charsRequired) {
     int written = 0;
     if ((uri == NULL) || ((dest == NULL) && (charsRequired == NULL))) {
         if (charsWritten != NULL) {
@@ -133,7 +131,7 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                             }

                             memcpy(dest + written, uri->scheme.first,
-                                   charsToWrite * sizeof(URI_CHAR));
+                                    charsToWrite * sizeof(URI_CHAR));
                             written += charsToWrite;
                         } else {
                             dest[0] = _UT('\0');
@@ -165,6 +163,11 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                             return URI_ERROR_TOSTRING_TOO_LONG;
                         }
                     } else {
+                        // Detect and avoid integer overflow
+                        if (1 > (size_t)INT_MAX - *charsRequired) {
+                            return URI_ERROR_TOSTRING_TOO_LONG;
+                        }
+
                         (*charsRequired) += 1;
                     }
                     /* clang-format off */
@@ -190,6 +193,11 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                             return URI_ERROR_TOSTRING_TOO_LONG;
                         }
                     } else {
+                        // Detect and avoid integer overflow
+                        if (2 > (size_t)INT_MAX - *charsRequired) {
+                            return URI_ERROR_TOSTRING_TOO_LONG;
+                        }
+
                         (*charsRequired) += 2;
                     }
                     /* clang-format off */
@@ -198,7 +206,7 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                     /* UserInfo */
                     if (uri->userInfo.first != NULL) {
                         const size_t charsToWrite =
-                            uri->userInfo.afterLast - uri->userInfo.first;
+                                uri->userInfo.afterLast - uri->userInfo.first;
                         if (dest != NULL) {
                             // Detect and avoid integer overflow
                             if (charsToWrite > (size_t)INT_MAX - written) {
@@ -212,7 +220,7 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                                 }

                                 memcpy(dest + written, uri->userInfo.first,
-                                       charsToWrite * sizeof(URI_CHAR));
+                                        charsToWrite * sizeof(URI_CHAR));
                                 written += charsToWrite;
                             } else {
                                 dest[0] = _UT('\0');
@@ -235,8 +243,8 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                         } else {
                             // Detect and avoid integer overflow
                             if ((charsToWrite > (size_t)INT_MAX - 1)
-                                || (charsToWrite + 1
-                                    > (size_t)INT_MAX - *charsRequired)) {
+                                    || (charsToWrite + 1
+                                            > (size_t)INT_MAX - *charsRequired)) {
                                 return URI_ERROR_TOSTRING_TOO_LONG;
                             }

@@ -251,7 +259,7 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                         for (; i < 4; i++) {
                             const unsigned char value = uri->hostData.ip4->data[i];
                             const int charsToWrite =
-                                (value > 99) ? 3 : ((value > 9) ? 2 : 1);
+                                    (value > 99) ? 3 : ((value > 9) ? 2 : 1);
                             if (dest != NULL) {
                                 if (written + charsToWrite <= maxChars) {
                                     URI_CHAR text[4];
@@ -267,7 +275,7 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                                     }
                                     text[charsToWrite] = _UT('\0');
                                     memcpy(dest + written, text,
-                                           charsToWrite * sizeof(URI_CHAR));
+                                            charsToWrite * sizeof(URI_CHAR));
                                     written += charsToWrite;
                                 } else {
                                     dest[0] = _UT('\0');
@@ -279,7 +287,7 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                                 if (i < 3) {
                                     if (written + 1 <= maxChars) {
                                         memcpy(dest + written, _UT("."),
-                                               1 * sizeof(URI_CHAR));
+                                                1 * sizeof(URI_CHAR));
                                         written += 1;
                                     } else {
                                         dest[0] = _UT('\0');
@@ -290,7 +298,16 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                                     }
                                 }
                             } else {
-                                (*charsRequired) += charsToWrite + ((i == 3) ? 0 : 1);
+                                const int extra = (i == 3) ? 0 : 1;
+
+                                // Detect and avoid integer overflow
+                                if (charsToWrite > INT_MAX - extra
+                                        || charsToWrite + extra
+                                                   > INT_MAX - *charsRequired) {
+                                    return URI_ERROR_TOSTRING_TOO_LONG;
+                                }
+
+                                (*charsRequired) += charsToWrite + extra;
                             }
                         }
                     } else if (uri->hostData.ip6 != NULL) {
@@ -308,6 +325,11 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                                 return URI_ERROR_TOSTRING_TOO_LONG;
                             }
                         } else {
+                            // Detect and avoid integer overflow
+                            if (1 > (size_t)INT_MAX - *charsRequired) {
+                                return URI_ERROR_TOSTRING_TOO_LONG;
+                            }
+
                             (*charsRequired) += 1;
                         }

@@ -316,10 +338,10 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                             if (dest != NULL) {
                                 if (written + 2 <= maxChars) {
                                     URI_CHAR text[3];
-                                    text[0] =
-                                        URI_FUNC(HexToLetterEx)(value / 16, URI_FALSE);
-                                    text[1] =
-                                        URI_FUNC(HexToLetterEx)(value % 16, URI_FALSE);
+                                    text[0] = URI_FUNC(HexToLetterEx)(
+                                            value / 16, URI_FALSE);
+                                    text[1] = URI_FUNC(HexToLetterEx)(
+                                            value % 16, URI_FALSE);
                                     text[2] = _UT('\0');
                                     memcpy(dest + written, text, 2 * sizeof(URI_CHAR));
                                     written += 2;
@@ -331,13 +353,18 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                                     return URI_ERROR_TOSTRING_TOO_LONG;
                                 }
                             } else {
+                                // Detect and avoid integer overflow
+                                if (2 > (size_t)INT_MAX - *charsRequired) {
+                                    return URI_ERROR_TOSTRING_TOO_LONG;
+                                }
+
                                 (*charsRequired) += 2;
                             }
                             if (((i & 1) == 1) && (i < 15)) {
                                 if (dest != NULL) {
                                     if (written + 1 <= maxChars) {
                                         memcpy(dest + written, _UT(":"),
-                                               1 * sizeof(URI_CHAR));
+                                                1 * sizeof(URI_CHAR));
                                         written += 1;
                                     } else {
                                         dest[0] = _UT('\0');
@@ -347,6 +374,11 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                                         return URI_ERROR_TOSTRING_TOO_LONG;
                                     }
                                 } else {
+                                    // Detect and avoid integer overflow
+                                    if (1 > (size_t)INT_MAX - *charsRequired) {
+                                        return URI_ERROR_TOSTRING_TOO_LONG;
+                                    }
+
                                     (*charsRequired) += 1;
                                 }
                             }
@@ -364,6 +396,11 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                                 return URI_ERROR_TOSTRING_TOO_LONG;
                             }
                         } else {
+                            // Detect and avoid integer overflow
+                            if (1 > (size_t)INT_MAX - *charsRequired) {
+                                return URI_ERROR_TOSTRING_TOO_LONG;
+                            }
+
                             (*charsRequired) += 1;
                         }
                     } else if (uri->hostData.ipFuture.first != NULL) {
@@ -394,7 +431,7 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                                 }

                                 memcpy(dest + written, uri->hostData.ipFuture.first,
-                                       charsToWrite * sizeof(URI_CHAR));
+                                        charsToWrite * sizeof(URI_CHAR));
                                 written += charsToWrite;
                             } else {
                                 dest[0] = _UT('\0');
@@ -417,8 +454,8 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                         } else {
                             // Detect and avoid integer overflow
                             if ((charsToWrite > (size_t)INT_MAX - 1 - 1)
-                                || (1 + charsToWrite + 1
-                                    > (size_t)INT_MAX - *charsRequired)) {
+                                    || (1 + charsToWrite + 1
+                                            > (size_t)INT_MAX - *charsRequired)) {
                                 return URI_ERROR_TOSTRING_TOO_LONG;
                             }

@@ -427,7 +464,7 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                     } else if (uri->hostText.first != NULL) {
                         /* Regname */
                         const size_t charsToWrite =
-                            uri->hostText.afterLast - uri->hostText.first;
+                                uri->hostText.afterLast - uri->hostText.first;
                         if (dest != NULL) {
                             // Detect and avoid integer overflow
                             if (charsToWrite > (size_t)INT_MAX - written) {
@@ -441,7 +478,7 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                                 }

                                 memcpy(dest + written, uri->hostText.first,
-                                       charsToWrite * sizeof(URI_CHAR));
+                                        charsToWrite * sizeof(URI_CHAR));
                                 written += charsToWrite;
                             } else {
                                 dest[0] = _UT('\0');
@@ -463,7 +500,7 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                     /* Port */
                     if (uri->portText.first != NULL) {
                         const size_t charsToWrite =
-                            uri->portText.afterLast - uri->portText.first;
+                                uri->portText.afterLast - uri->portText.first;
                         if (dest != NULL) {
                             /* Leading ':' */
                             if (written + 1 <= maxChars) {
@@ -490,7 +527,7 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                                 }

                                 memcpy(dest + written, uri->portText.first,
-                                       charsToWrite * sizeof(URI_CHAR));
+                                        charsToWrite * sizeof(URI_CHAR));
                                 written += charsToWrite;
                             } else {
                                 dest[0] = _UT('\0');
@@ -502,8 +539,8 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                         } else {
                             // Detect and avoid integer overflow
                             if ((charsToWrite > (size_t)INT_MAX - 1)
-                                || (1 + charsToWrite
-                                    > (size_t)INT_MAX - *charsRequired)) {
+                                    || (1 + charsToWrite
+                                            > (size_t)INT_MAX - *charsRequired)) {
                                 return URI_ERROR_TOSTRING_TOO_LONG;
                             }

@@ -519,7 +556,7 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                 /* clang-format on */
                 /* Slash needed here? */
                 if (uri->absolutePath
-                    || ((uri->pathHead != NULL) && URI_FUNC(HasHost)(uri))) {
+                        || ((uri->pathHead != NULL) && URI_FUNC(HasHost)(uri))) {
                     if (dest != NULL) {
                         if (written + 1 <= maxChars) {
                             memcpy(dest + written, _UT("/"), 1 * sizeof(URI_CHAR));
@@ -532,6 +569,11 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                             return URI_ERROR_TOSTRING_TOO_LONG;
                         }
                     } else {
+                        // Detect and avoid integer overflow
+                        if (1 > (size_t)INT_MAX - *charsRequired) {
+                            return URI_ERROR_TOSTRING_TOO_LONG;
+                        }
+
                         (*charsRequired) += 1;
                     }
                 }
@@ -540,7 +582,7 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                     URI_TYPE(PathSegment) * walker = uri->pathHead;
                     do {
                         const size_t charsToWrite =
-                            walker->text.afterLast - walker->text.first;
+                                walker->text.afterLast - walker->text.first;
                         if (dest != NULL) {
                             // Detect and avoid integer overflow
                             if (charsToWrite > (size_t)INT_MAX - written) {
@@ -554,7 +596,7 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                                 }

                                 memcpy(dest + written, walker->text.first,
-                                       charsToWrite * sizeof(URI_CHAR));
+                                        charsToWrite * sizeof(URI_CHAR));
                                 written += charsToWrite;
                             } else {
                                 dest[0] = _UT('\0');
@@ -577,7 +619,7 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                             if (dest != NULL) {
                                 if (written + 1 <= maxChars) {
                                     memcpy(dest + written, _UT("/"),
-                                           1 * sizeof(URI_CHAR));
+                                            1 * sizeof(URI_CHAR));
                                     written += 1;
                                 } else {
                                     dest[0] = _UT('\0');
@@ -587,6 +629,11 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                                     return URI_ERROR_TOSTRING_TOO_LONG;
                                 }
                             } else {
+                                // Detect and avoid integer overflow
+                                if (1 > (size_t)INT_MAX - *charsRequired) {
+                                    return URI_ERROR_TOSTRING_TOO_LONG;
+                                }
+
                                 (*charsRequired) += 1;
                             }
                         }
@@ -613,6 +660,11 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                             return URI_ERROR_TOSTRING_TOO_LONG;
                         }
                     } else {
+                        // Detect and avoid integer overflow
+                        if (1 > (size_t)INT_MAX - *charsRequired) {
+                            return URI_ERROR_TOSTRING_TOO_LONG;
+                        }
+
                         (*charsRequired) += 1;
                     }
                     /* clang-format off */
@@ -632,7 +684,7 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                             }

                             memcpy(dest + written, uri->query.first,
-                                   charsToWrite * sizeof(URI_CHAR));
+                                    charsToWrite * sizeof(URI_CHAR));
                             written += charsToWrite;
                         } else {
                             dest[0] = _UT('\0');
@@ -672,13 +724,18 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                             return URI_ERROR_TOSTRING_TOO_LONG;
                         }
                     } else {
+                        // Detect and avoid integer overflow
+                        if (1 > (size_t)INT_MAX - *charsRequired) {
+                            return URI_ERROR_TOSTRING_TOO_LONG;
+                        }
+
                         (*charsRequired) += 1;
                     }
                     /* clang-format off */
     /* [17/19]     append fragment to result; */
                     /* clang-format on */
                     const size_t charsToWrite =
-                        uri->fragment.afterLast - uri->fragment.first;
+                            uri->fragment.afterLast - uri->fragment.first;
                     if (dest != NULL) {
                         // Detect and avoid integer overflow
                         if (charsToWrite > (size_t)INT_MAX - written) {
@@ -692,7 +749,7 @@ static URI_INLINE int URI_FUNC(ToStringEngine)(URI_CHAR * dest, const URI_TYPE(U
                             }

                             memcpy(dest + written, uri->fragment.first,
-                                   charsToWrite * sizeof(URI_CHAR));
+                                    charsToWrite * sizeof(URI_CHAR));
                             written += charsToWrite;
                         } else {
                             dest[0] = _UT('\0');
diff --git a/ext/uri/uriparser/src/UriResolve.c b/ext/uri/uriparser/src/UriResolve.c
index 90c8bfd778d..449418119ae 100644
--- a/ext/uri/uriparser/src/UriResolve.c
+++ b/ext/uri/uriparser/src/UriResolve.c
@@ -68,8 +68,7 @@
 /* Appends a relative URI to an absolute. The last path segment of
  * the absolute URI is replaced. */
 static URI_INLINE UriBool URI_FUNC(MergePath)(URI_TYPE(Uri) * absWork,
-                                              const URI_TYPE(Uri) * relAppend,
-                                              UriMemoryManager * memory) {
+        const URI_TYPE(Uri) * relAppend, UriMemoryManager * memory) {
     URI_TYPE(PathSegment) * sourceWalker;
     URI_TYPE(PathSegment) * destPrev;
     if (relAppend->pathHead == NULL) {
@@ -79,7 +78,7 @@ static URI_INLINE UriBool URI_FUNC(MergePath)(URI_TYPE(Uri) * absWork,
     /* Replace last segment ("" if trailing slash) with first of append chain */
     if (absWork->pathHead == NULL) {
         URI_TYPE(PathSegment) * const dup =
-            memory->malloc(memory, sizeof(URI_TYPE(PathSegment)));
+                memory->malloc(memory, sizeof(URI_TYPE(PathSegment)));
         if (dup == NULL) {
             return URI_FALSE; /* Raises malloc error */
         }
@@ -99,7 +98,7 @@ static URI_INLINE UriBool URI_FUNC(MergePath)(URI_TYPE(Uri) * absWork,

     for (;;) {
         URI_TYPE(PathSegment) * const dup =
-            memory->malloc(memory, sizeof(URI_TYPE(PathSegment)));
+                memory->malloc(memory, sizeof(URI_TYPE(PathSegment)));
         if (dup == NULL) {
             destPrev->next = NULL;
             absWork->pathTail = destPrev;
@@ -120,8 +119,8 @@ static URI_INLINE UriBool URI_FUNC(MergePath)(URI_TYPE(Uri) * absWork,
     return URI_TRUE;
 }

-static int URI_FUNC(ResolveAbsolutePathFlag)(URI_TYPE(Uri) * absWork,
-                                             UriMemoryManager * memory) {
+static int URI_FUNC(ResolveAbsolutePathFlag)(
+        URI_TYPE(Uri) * absWork, UriMemoryManager * memory) {
     if (absWork == NULL) {
         return URI_ERROR_NULL;
     }
@@ -130,7 +129,7 @@ static int URI_FUNC(ResolveAbsolutePathFlag)(URI_TYPE(Uri) * absWork,
         /* Empty segment needed, instead? */
         if (absWork->pathHead == NULL) {
             URI_TYPE(PathSegment) * const segment =
-                memory->malloc(memory, sizeof(URI_TYPE(PathSegment)));
+                    memory->malloc(memory, sizeof(URI_TYPE(PathSegment)));
             if (segment == NULL) {
                 return URI_ERROR_MALLOC;
             }
@@ -149,10 +148,8 @@ static int URI_FUNC(ResolveAbsolutePathFlag)(URI_TYPE(Uri) * absWork,
 }

 static int URI_FUNC(AddBaseUriImpl)(URI_TYPE(Uri) * absDest,
-                                    const URI_TYPE(Uri) * relSource,
-                                    const URI_TYPE(Uri) * absBase,
-                                    UriResolutionOptions options,
-                                    UriMemoryManager * memory) {
+        const URI_TYPE(Uri) * relSource, const URI_TYPE(Uri) * absBase,
+        UriResolutionOptions options, UriMemoryManager * memory) {
     UriBool relSourceHasScheme;

     if (absDest == NULL) {
@@ -179,12 +176,12 @@ static int URI_FUNC(AddBaseUriImpl)(URI_TYPE(Uri) * absDest,
     /* [00/32] if ((not strict) and (R.scheme == Base.scheme)) then */
                 /* clang-format on */
                 relSourceHasScheme =
-                    (relSource->scheme.first != NULL) ? URI_TRUE : URI_FALSE;
+                        (relSource->scheme.first != NULL) ? URI_TRUE : URI_FALSE;
                 if ((options & URI_RESOLVE_IDENTICAL_SCHEME_COMPAT)
-                    && (absBase->scheme.first != NULL)
-                    && (relSource->scheme.first != NULL)
-                    && (URI_FUNC(RangeEquals)(&(absBase->scheme),
-                                              &(relSource->scheme)))) {
+                        && (absBase->scheme.first != NULL)
+                        && (relSource->scheme.first != NULL)
+                        && (URI_FUNC(RangeEquals)(
+                                &(absBase->scheme), &(relSource->scheme)))) {
                     /* clang-format off */
     /* [00/32]     undefine(R.scheme); */
                     /* clang-format on */
@@ -307,8 +304,8 @@ static int URI_FUNC(AddBaseUriImpl)(URI_TYPE(Uri) * absDest,
                                 if (res != URI_SUCCESS) {
                                     return res;
                                 }
-                                if (!URI_FUNC(RemoveDotSegmentsAbsolute)(absDest,
-                                                                         memory)) {
+                                if (!URI_FUNC(RemoveDotSegmentsAbsolute)(
+                                            absDest, memory)) {
                                     return URI_ERROR_MALLOC;
                                 }
                                 /* clang-format off */
@@ -327,8 +324,8 @@ static int URI_FUNC(AddBaseUriImpl)(URI_TYPE(Uri) * absDest,
                                 /* clang-format off */
     /* [24/32]                 T.path = remove_dot_segments(T.path); */
                                 /* clang-format on */
-                                if (!URI_FUNC(RemoveDotSegmentsAbsolute)(absDest,
-                                                                         memory)) {
+                                if (!URI_FUNC(RemoveDotSegmentsAbsolute)(
+                                            absDest, memory)) {
                                     return URI_ERROR_MALLOC;
                                 }

@@ -370,19 +367,19 @@ static int URI_FUNC(AddBaseUriImpl)(URI_TYPE(Uri) * absDest,
 }

 int URI_FUNC(AddBaseUri)(URI_TYPE(Uri) * absDest, const URI_TYPE(Uri) * relSource,
-                         const URI_TYPE(Uri) * absBase) {
+        const URI_TYPE(Uri) * absBase) {
     const UriResolutionOptions options = URI_RESOLVE_STRICTLY;
     return URI_FUNC(AddBaseUriEx)(absDest, relSource, absBase, options);
 }

 int URI_FUNC(AddBaseUriEx)(URI_TYPE(Uri) * absDest, const URI_TYPE(Uri) * relSource,
-                           const URI_TYPE(Uri) * absBase, UriResolutionOptions options) {
+        const URI_TYPE(Uri) * absBase, UriResolutionOptions options) {
     return URI_FUNC(AddBaseUriExMm)(absDest, relSource, absBase, options, NULL);
 }

 int URI_FUNC(AddBaseUriExMm)(URI_TYPE(Uri) * absDest, const URI_TYPE(Uri) * relSource,
-                             const URI_TYPE(Uri) * absBase, UriResolutionOptions options,
-                             UriMemoryManager * memory) {
+        const URI_TYPE(Uri) * absBase, UriResolutionOptions options,
+        UriMemoryManager * memory) {
     int res;

     URI_CHECK_MEMORY_MANAGER(memory); /* may return */
diff --git a/ext/uri/uriparser/src/UriSetFragment.c b/ext/uri/uriparser/src/UriSetFragment.c
index 4479391d859..1b29ab383df 100644
--- a/ext/uri/uriparser/src/UriSetFragment.c
+++ b/ext/uri/uriparser/src/UriSetFragment.c
@@ -67,8 +67,8 @@

 #  include <assert.h>

-UriBool URI_FUNC(IsWellFormedFragment)(const URI_CHAR * first,
-                                       const URI_CHAR * afterLast) {
+UriBool URI_FUNC(IsWellFormedFragment)(
+        const URI_CHAR * first, const URI_CHAR * afterLast) {
     if ((first == NULL) || (afterLast == NULL)) {
         return URI_FALSE;
     }
@@ -117,7 +117,7 @@ UriBool URI_FUNC(IsWellFormedFragment)(const URI_CHAR * first,
 }

 int URI_FUNC(SetFragmentMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                            const URI_CHAR * afterLast, UriMemoryManager * memory) {
+        const URI_CHAR * afterLast, UriMemoryManager * memory) {
     /* Input validation (before making any changes) */
     if ((uri == NULL) || ((first == NULL) != (afterLast == NULL))) {
         return URI_ERROR_NULL;
@@ -126,7 +126,7 @@ int URI_FUNC(SetFragmentMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
     URI_CHECK_MEMORY_MANAGER(memory); /* may return */

     if ((first != NULL)
-        && (URI_FUNC(IsWellFormedFragment)(first, afterLast) == URI_FALSE)) {
+            && (URI_FUNC(IsWellFormedFragment)(first, afterLast) == URI_FALSE)) {
         return URI_ERROR_SYNTAX;
     }

@@ -166,8 +166,8 @@ int URI_FUNC(SetFragmentMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
     return URI_SUCCESS;
 }

-int URI_FUNC(SetFragment)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                          const URI_CHAR * afterLast) {
+int URI_FUNC(SetFragment)(
+        URI_TYPE(Uri) * uri, const URI_CHAR * first, const URI_CHAR * afterLast) {
     return URI_FUNC(SetFragmentMm)(uri, first, afterLast, NULL);
 }

diff --git a/ext/uri/uriparser/src/UriSetHostAuto.c b/ext/uri/uriparser/src/UriSetHostAuto.c
index df015880b33..95c40c2f687 100644
--- a/ext/uri/uriparser/src/UriSetHostAuto.c
+++ b/ext/uri/uriparser/src/UriSetHostAuto.c
@@ -68,7 +68,7 @@
 #  include <assert.h>

 int URI_FUNC(SetHostAutoMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                            const URI_CHAR * afterLast, UriMemoryManager * memory) {
+        const URI_CHAR * afterLast, UriMemoryManager * memory) {
     if ((uri == NULL) || ((first == NULL) != (afterLast == NULL))) {
         return URI_ERROR_NULL;
     }
@@ -116,8 +116,8 @@ int URI_FUNC(SetHostAutoMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
     return URI_FUNC(InternalSetHostMm)(uri, hostType, first, afterLast, memory);
 }

-int URI_FUNC(SetHostAuto)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                          const URI_CHAR * afterLast) {
+int URI_FUNC(SetHostAuto)(
+        URI_TYPE(Uri) * uri, const URI_CHAR * first, const URI_CHAR * afterLast) {
     return URI_FUNC(SetHostAutoMm)(uri, first, afterLast, NULL);
 }

diff --git a/ext/uri/uriparser/src/UriSetHostCommon.c b/ext/uri/uriparser/src/UriSetHostCommon.c
index bd8095aea3c..bd0ef8bef48 100644
--- a/ext/uri/uriparser/src/UriSetHostCommon.c
+++ b/ext/uri/uriparser/src/UriSetHostCommon.c
@@ -76,8 +76,7 @@
 #  include <assert.h>

 int URI_FUNC(InternalSetHostMm)(URI_TYPE(Uri) * uri, UriHostType hostType,
-                                const URI_CHAR * first, const URI_CHAR * afterLast,
-                                UriMemoryManager * memory) {
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory) {
     /* Superficial input validation (before making any changes) */
     if ((uri == NULL) || ((first == NULL) != (afterLast == NULL))) {
         return URI_ERROR_NULL;
@@ -107,16 +106,16 @@ int URI_FUNC(InternalSetHostMm)(URI_TYPE(Uri) * uri, UriHostType hostType,
         case URI_HOST_TYPE_IP6: {
             const int res = URI_FUNC(IsWellFormedHostIp6Mm)(first, afterLast, memory);
             assert((res == URI_SUCCESS) || (res == URI_ERROR_SYNTAX)
-                   || (res == URI_ERROR_MALLOC));
+                    || (res == URI_ERROR_MALLOC));
             if (res != URI_SUCCESS) {
                 return res;
             }
         } break;
         case URI_HOST_TYPE_IPFUTURE: {
             const int res =
-                URI_FUNC(IsWellFormedHostIpFutureMm)(first, afterLast, memory);
+                    URI_FUNC(IsWellFormedHostIpFutureMm)(first, afterLast, memory);
             assert((res == URI_SUCCESS) || (res == URI_ERROR_SYNTAX)
-                   || (res == URI_ERROR_MALLOC));
+                    || (res == URI_ERROR_MALLOC));
             if (res != URI_SUCCESS) {
                 return res;
             }
@@ -140,14 +139,14 @@ int URI_FUNC(InternalSetHostMm)(URI_TYPE(Uri) * uri, UriHostType hostType,
         uri->hostText.afterLast = NULL;

         if ((uri->owner == URI_TRUE)
-            && (uri->hostData.ipFuture.first != uri->hostData.ipFuture.afterLast)) {
+                && (uri->hostData.ipFuture.first != uri->hostData.ipFuture.afterLast)) {
             memory->free(memory, (URI_CHAR *)uri->hostData.ipFuture.first);
         }
         uri->hostData.ipFuture.first = NULL;
         uri->hostData.ipFuture.afterLast = NULL;
     } else if (uri->hostText.first != NULL) {
         if ((uri->owner == URI_TRUE)
-            && (uri->hostText.first != uri->hostText.afterLast)) {
+                && (uri->hostText.first != uri->hostText.afterLast)) {
             memory->free(memory, (URI_CHAR *)uri->hostText.first);
         }
         uri->hostText.first = NULL;
@@ -171,7 +170,7 @@ int URI_FUNC(InternalSetHostMm)(URI_TYPE(Uri) * uri, UriHostType hostType,
             }

             const UriBool success =
-                URI_FUNC(EnsureThatPathIsNotMistakenForHost)(uri, memory);
+                    URI_FUNC(EnsureThatPathIsNotMistakenForHost)(uri, memory);
             return (success == URI_TRUE) ? URI_SUCCESS : URI_ERROR_MALLOC;
         }

@@ -210,7 +209,7 @@ int URI_FUNC(InternalSetHostMm)(URI_TYPE(Uri) * uri, UriHostType hostType,
         }

         const int res =
-            URI_FUNC(ParseIpFourAddress)(uri->hostData.ip4->data, first, afterLast);
+                URI_FUNC(ParseIpFourAddress)(uri->hostData.ip4->data, first, afterLast);
 #  if defined(NDEBUG)
         (void)res; /* i.e. mark as unused */
 #  else
@@ -223,11 +222,11 @@ int URI_FUNC(InternalSetHostMm)(URI_TYPE(Uri) * uri, UriHostType hostType,
             return URI_ERROR_MALLOC;
         }

-        const int res =
-            URI_FUNC(ParseIpSixAddressMm)(uri->hostData.ip6, first, afterLast, memory);
+        const int res = URI_FUNC(ParseIpSixAddressMm)(
+                uri->hostData.ip6, first, afterLast, memory);
         assert((res == URI_SUCCESS)
-               || (res == URI_ERROR_MALLOC)); /* because checked for
-                                                 well-formedness earlier */
+                || (res == URI_ERROR_MALLOC)); /* because checked for
+                                                  well-formedness earlier */
         if (res != URI_SUCCESS) {
             return res;
         }
diff --git a/ext/uri/uriparser/src/UriSetHostCommon.h b/ext/uri/uriparser/src/UriSetHostCommon.h
index 6627767f2ca..b4eea4e3775 100644
--- a/ext/uri/uriparser/src/UriSetHostCommon.h
+++ b/ext/uri/uriparser/src/UriSetHostCommon.h
@@ -37,8 +37,8 @@
  */

 #if (defined(URI_PASS_ANSI) && !defined(URI_SET_HOST_COMMON_H_ANSI)) \
-    || (defined(URI_PASS_UNICODE) && !defined(URI_SET_HOST_COMMON_H_UNICODE)) \
-    || (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
+        || (defined(URI_PASS_UNICODE) && !defined(URI_SET_HOST_COMMON_H_UNICODE)) \
+        || (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
 /* What encodings are enabled? */
 #  include <uriparser/UriDefsConfig.h>
 #  if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
@@ -55,9 +55,9 @@
 #    endif
 /* Only one pass for each encoding */
 #  elif (defined(URI_PASS_ANSI) && !defined(URI_SET_HOST_COMMON_H_ANSI) \
-         && defined(URI_ENABLE_ANSI)) \
-      || (defined(URI_PASS_UNICODE) && !defined(URI_SET_HOST_COMMON_H_UNICODE) \
-          && defined(URI_ENABLE_UNICODE))
+          && defined(URI_ENABLE_ANSI)) \
+          || (defined(URI_PASS_UNICODE) && !defined(URI_SET_HOST_COMMON_H_UNICODE) \
+                  && defined(URI_ENABLE_UNICODE))
 #    ifdef URI_PASS_ANSI
 #      define URI_SET_HOST_COMMON_H_ANSI 1
 #      include <uriparser/UriDefsAnsi.h>
@@ -67,8 +67,7 @@
 #    endif

 int URI_FUNC(InternalSetHostMm)(URI_TYPE(Uri) * uri, UriHostType hostType,
-                                const URI_CHAR * first, const URI_CHAR * afterLast,
-                                UriMemoryManager * memory);
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory);

 #  endif
 #endif
diff --git a/ext/uri/uriparser/src/UriSetHostIp4.c b/ext/uri/uriparser/src/UriSetHostIp4.c
index e52880be4c4..69107d16c9e 100644
--- a/ext/uri/uriparser/src/UriSetHostIp4.c
+++ b/ext/uri/uriparser/src/UriSetHostIp4.c
@@ -66,25 +66,25 @@
 #    include "UriSetHostCommon.h"
 #  endif

-UriBool URI_FUNC(IsWellFormedHostIp4)(const URI_CHAR * first,
-                                      const URI_CHAR * afterLast) {
+UriBool URI_FUNC(IsWellFormedHostIp4)(
+        const URI_CHAR * first, const URI_CHAR * afterLast) {
     if ((first == NULL) || (afterLast == NULL)) {
         return URI_FALSE;
     }

     unsigned char octetOutput[4];
     return (URI_FUNC(ParseIpFourAddress)(octetOutput, first, afterLast) == URI_SUCCESS)
-               ? URI_TRUE
-               : URI_FALSE;
+                   ? URI_TRUE
+                   : URI_FALSE;
 }

 int URI_FUNC(SetHostIp4Mm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                           const URI_CHAR * afterLast, UriMemoryManager * memory) {
+        const URI_CHAR * afterLast, UriMemoryManager * memory) {
     return URI_FUNC(InternalSetHostMm)(uri, URI_HOST_TYPE_IP4, first, afterLast, memory);
 }

-int URI_FUNC(SetHostIp4)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                         const URI_CHAR * afterLast) {
+int URI_FUNC(SetHostIp4)(
+        URI_TYPE(Uri) * uri, const URI_CHAR * first, const URI_CHAR * afterLast) {
     return URI_FUNC(SetHostIp4Mm)(uri, first, afterLast, NULL);
 }

diff --git a/ext/uri/uriparser/src/UriSetHostIp6.c b/ext/uri/uriparser/src/UriSetHostIp6.c
index 9637a4384b2..0b5b3de2fbd 100644
--- a/ext/uri/uriparser/src/UriSetHostIp6.c
+++ b/ext/uri/uriparser/src/UriSetHostIp6.c
@@ -73,7 +73,7 @@
                        */

 int URI_FUNC(ParseIpSixAddressMm)(UriIp6 * output, const URI_CHAR * first,
-                                  const URI_CHAR * afterLast, UriMemoryManager * memory) {
+        const URI_CHAR * afterLast, UriMemoryManager * memory) {
     /* NOTE: output is allowed to be NULL */
     if ((first == NULL) || (afterLast == NULL)) {
         return URI_ERROR_NULL;
@@ -107,16 +107,16 @@ int URI_FUNC(ParseIpSixAddressMm)(UriIp6 * output, const URI_CHAR * first,

     memcpy(candidate + 3, first, inputLenChars * sizeof(URI_CHAR));
     memcpy(candidate + 3 + inputLenChars, _UT("]"),
-           2 * sizeof(URI_CHAR)); /* includes zero terminator */
+            2 * sizeof(URI_CHAR)); /* includes zero terminator */

     /* Parse as an RFC 3986 URI */
     const size_t candidateLenChars = 3 + inputLenChars + 1;
     URI_TYPE(Uri) uri;
     const int res = URI_FUNC(ParseSingleUriExMm)(
-        &uri, candidate, candidate + candidateLenChars, NULL, memory);
+            &uri, candidate, candidate + candidateLenChars, NULL, memory);

     assert((res == URI_SUCCESS) || (res == URI_ERROR_SYNTAX)
-           || (res == URI_ERROR_MALLOC));
+            || (res == URI_ERROR_MALLOC));

     if (res == URI_SUCCESS) {
         assert(uri.hostData.ip6 != NULL);
@@ -131,13 +131,13 @@ int URI_FUNC(ParseIpSixAddressMm)(UriIp6 * output, const URI_CHAR * first,
     return res;
 }

-int URI_FUNC(ParseIpSixAddress)(UriIp6 * output, const URI_CHAR * first,
-                                const URI_CHAR * afterLast) {
+int URI_FUNC(ParseIpSixAddress)(
+        UriIp6 * output, const URI_CHAR * first, const URI_CHAR * afterLast) {
     return URI_FUNC(ParseIpSixAddressMm)(output, first, afterLast, NULL);
 }

-int URI_FUNC(IsWellFormedHostIp6Mm)(const URI_CHAR * first, const URI_CHAR * afterLast,
-                                    UriMemoryManager * memory) {
+int URI_FUNC(IsWellFormedHostIp6Mm)(
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory) {
     return URI_FUNC(ParseIpSixAddressMm)(NULL, first, afterLast, memory);
 }

@@ -146,12 +146,12 @@ int URI_FUNC(IsWellFormedHostIp6)(const URI_CHAR * first, const URI_CHAR * after
 }

 int URI_FUNC(SetHostIp6Mm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                           const URI_CHAR * afterLast, UriMemoryManager * memory) {
+        const URI_CHAR * afterLast, UriMemoryManager * memory) {
     return URI_FUNC(InternalSetHostMm)(uri, URI_HOST_TYPE_IP6, first, afterLast, memory);
 }

-int URI_FUNC(SetHostIp6)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                         const URI_CHAR * afterLast) {
+int URI_FUNC(SetHostIp6)(
+        URI_TYPE(Uri) * uri, const URI_CHAR * first, const URI_CHAR * afterLast) {
     return URI_FUNC(SetHostIp6Mm)(uri, first, afterLast, NULL);
 }

diff --git a/ext/uri/uriparser/src/UriSetHostIpFuture.c b/ext/uri/uriparser/src/UriSetHostIpFuture.c
index c5044c49c76..10be0e05f27 100644
--- a/ext/uri/uriparser/src/UriSetHostIpFuture.c
+++ b/ext/uri/uriparser/src/UriSetHostIpFuture.c
@@ -68,9 +68,8 @@
 #  include <assert.h>
 #  include <string.h> /* for memcpy */

-int URI_FUNC(IsWellFormedHostIpFutureMm)(const URI_CHAR * first,
-                                         const URI_CHAR * afterLast,
-                                         UriMemoryManager * memory) {
+int URI_FUNC(IsWellFormedHostIpFutureMm)(
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory) {
     if ((first == NULL) || (afterLast == NULL)) {
         return URI_ERROR_NULL;
     }
@@ -109,7 +108,7 @@ int URI_FUNC(IsWellFormedHostIpFutureMm)(const URI_CHAR * first,
     }

     URI_CHAR * const candidate =
-        memory->malloc(memory, (candidateLenChars + 1) * sizeof(URI_CHAR));
+            memory->malloc(memory, (candidateLenChars + 1) * sizeof(URI_CHAR));

     if (candidate == NULL) {
         return URI_ERROR_MALLOC;
@@ -118,15 +117,15 @@ int URI_FUNC(IsWellFormedHostIpFutureMm)(const URI_CHAR * first,
     memcpy(candidate, _UT("//["), 3 * sizeof(URI_CHAR));
     memcpy(candidate + 3, first, inputLenChars * sizeof(URI_CHAR));
     memcpy(candidate + 3 + inputLenChars, _UT("]"),
-           2 * sizeof(URI_CHAR)); /* includes zero terminator */
+            2 * sizeof(URI_CHAR)); /* includes zero terminator */

     /* Parse as an RFC 3986 URI */
     URI_TYPE(Uri) uri;
     const int res = URI_FUNC(ParseSingleUriExMm)(
-        &uri, candidate, candidate + candidateLenChars, NULL, memory);
+            &uri, candidate, candidate + candidateLenChars, NULL, memory);

     assert((res == URI_SUCCESS) || (res == URI_ERROR_SYNTAX)
-           || (res == URI_ERROR_MALLOC));
+            || (res == URI_ERROR_MALLOC));

     if (res == URI_SUCCESS) {
         assert(uri.hostData.ipFuture.first != NULL);
@@ -138,19 +137,19 @@ int URI_FUNC(IsWellFormedHostIpFutureMm)(const URI_CHAR * first,
     return res;
 }

-int URI_FUNC(IsWellFormedHostIpFuture)(const URI_CHAR * first,
-                                       const URI_CHAR * afterLast) {
+int URI_FUNC(IsWellFormedHostIpFuture)(
+        const URI_CHAR * first, const URI_CHAR * afterLast) {
     return URI_FUNC(IsWellFormedHostIpFutureMm)(first, afterLast, NULL);
 }

 int URI_FUNC(SetHostIpFutureMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                                const URI_CHAR * afterLast, UriMemoryManager * memory) {
-    return URI_FUNC(InternalSetHostMm)(uri, URI_HOST_TYPE_IPFUTURE, first, afterLast,
-                                       memory);
+        const URI_CHAR * afterLast, UriMemoryManager * memory) {
+    return URI_FUNC(InternalSetHostMm)(
+            uri, URI_HOST_TYPE_IPFUTURE, first, afterLast, memory);
 }

-int URI_FUNC(SetHostIpFuture)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                              const URI_CHAR * afterLast) {
+int URI_FUNC(SetHostIpFuture)(
+        URI_TYPE(Uri) * uri, const URI_CHAR * first, const URI_CHAR * afterLast) {
     return URI_FUNC(SetHostIpFutureMm)(uri, first, afterLast, NULL);
 }

diff --git a/ext/uri/uriparser/src/UriSetHostRegName.c b/ext/uri/uriparser/src/UriSetHostRegName.c
index 01bc4e47f16..1ea5ac56e33 100644
--- a/ext/uri/uriparser/src/UriSetHostRegName.c
+++ b/ext/uri/uriparser/src/UriSetHostRegName.c
@@ -66,8 +66,8 @@
 #    include "UriSets.h"
 #  endif

-UriBool URI_FUNC(IsWellFormedHostRegName)(const URI_CHAR * first,
-                                          const URI_CHAR * afterLast) {
+UriBool URI_FUNC(IsWellFormedHostRegName)(
+        const URI_CHAR * first, const URI_CHAR * afterLast) {
     if ((first == NULL) || (afterLast == NULL)) {
         return URI_FALSE;
     }
@@ -111,13 +111,13 @@ UriBool URI_FUNC(IsWellFormedHostRegName)(const URI_CHAR * first,
 }

 int URI_FUNC(SetHostRegNameMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                               const URI_CHAR * afterLast, UriMemoryManager * memory) {
-    return URI_FUNC(InternalSetHostMm)(uri, URI_HOST_TYPE_REGNAME, first, afterLast,
-                                       memory);
+        const URI_CHAR * afterLast, UriMemoryManager * memory) {
+    return URI_FUNC(InternalSetHostMm)(
+            uri, URI_HOST_TYPE_REGNAME, first, afterLast, memory);
 }

-int URI_FUNC(SetHostRegName)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                             const URI_CHAR * afterLast) {
+int URI_FUNC(SetHostRegName)(
+        URI_TYPE(Uri) * uri, const URI_CHAR * first, const URI_CHAR * afterLast) {
     return URI_FUNC(SetHostRegNameMm)(uri, first, afterLast, NULL);
 }

diff --git a/ext/uri/uriparser/src/UriSetPath.c b/ext/uri/uriparser/src/UriSetPath.c
index 17aef0fca42..b572f1ea0ac 100644
--- a/ext/uri/uriparser/src/UriSetPath.c
+++ b/ext/uri/uriparser/src/UriSetPath.c
@@ -67,8 +67,8 @@

 #  include <assert.h>

-UriBool URI_FUNC(IsWellFormedPath)(const URI_CHAR * first, const URI_CHAR * afterLast,
-                                   UriBool hasHost) {
+UriBool URI_FUNC(IsWellFormedPath)(
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriBool hasHost) {
     if ((first == NULL) || (afterLast == NULL)) {
         return URI_FALSE;
     }
@@ -142,8 +142,8 @@ UriBool URI_FUNC(IsWellFormedPath)(const URI_CHAR * first, const URI_CHAR * afte
     return URI_TRUE;
 }

-static void URI_FUNC(DropEmptyFirstPathSegment)(URI_TYPE(Uri) * uri,
-                                                UriMemoryManager * memory) {
+static void URI_FUNC(DropEmptyFirstPathSegment)(
+        URI_TYPE(Uri) * uri, UriMemoryManager * memory) {
     assert(uri != NULL);
     assert(memory != NULL);
     assert(uri->pathHead != NULL);
@@ -162,13 +162,13 @@ static void URI_FUNC(DropEmptyFirstPathSegment)(URI_TYPE(Uri) * uri,
  * This function checks for a leading empty path segment (that would have the "visual
  * effect" of a leading slash during stringification) and transforms it into .absolutePath
  * == URI_TRUE instead, if present. */
-static void URI_FUNC(TransformEmptyLeadPathSegments)(URI_TYPE(Uri) * uri,
-                                                     UriMemoryManager * memory) {
+static void URI_FUNC(TransformEmptyLeadPathSegments)(
+        URI_TYPE(Uri) * uri, UriMemoryManager * memory) {
     assert(uri != NULL);
     assert(memory != NULL);

     if ((URI_FUNC(HasHost)(uri) == URI_TRUE) || (uri->pathHead == NULL)
-        || (uri->pathHead->text.first != uri->pathHead->text.afterLast)) {
+            || (uri->pathHead->text.first != uri->pathHead->text.afterLast)) {
         return; /* i.e. nothing to do */
     }

@@ -180,8 +180,7 @@ static void URI_FUNC(TransformEmptyLeadPathSegments)(URI_TYPE(Uri) * uri,
 }

 static int URI_FUNC(InternalSetPath)(URI_TYPE(Uri) * destUri, const URI_CHAR * first,
-                                     const URI_CHAR * afterLast,
-                                     UriMemoryManager * memory) {
+        const URI_CHAR * afterLast, UriMemoryManager * memory) {
     assert(destUri != NULL);
     assert(first != NULL);
     assert(afterLast != NULL);
@@ -220,7 +219,7 @@ static int URI_FUNC(InternalSetPath)(URI_TYPE(Uri) * destUri, const URI_CHAR * f
     }

     URI_CHAR * const candidate =
-        memory->malloc(memory, (candidateLenChars + 1) * sizeof(URI_CHAR));
+            memory->malloc(memory, (candidateLenChars + 1) * sizeof(URI_CHAR));

     if (candidate == NULL) {
         return URI_ERROR_MALLOC;
@@ -232,10 +231,10 @@ static int URI_FUNC(InternalSetPath)(URI_TYPE(Uri) * destUri, const URI_CHAR * f

     /* Parse as an RFC 3986 URI */
     URI_TYPE(Uri) tempUri;
-    int res = URI_FUNC(ParseSingleUriExMm)(&tempUri, candidate,
-                                           candidate + candidateLenChars, NULL, memory);
+    int res = URI_FUNC(ParseSingleUriExMm)(
+            &tempUri, candidate, candidate + candidateLenChars, NULL, memory);
     assert((res == URI_SUCCESS) || (res == URI_ERROR_SYNTAX)
-           || (res == URI_ERROR_MALLOC));
+            || (res == URI_ERROR_MALLOC));
     if (res != URI_SUCCESS) {
         memory->free(memory, candidate);
         return res;
@@ -290,7 +289,7 @@ static int URI_FUNC(InternalSetPath)(URI_TYPE(Uri) * destUri, const URI_CHAR * f
 }

 int URI_FUNC(SetPathMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                        const URI_CHAR * afterLast, UriMemoryManager * memory) {
+        const URI_CHAR * afterLast, UriMemoryManager * memory) {
     /* Input validation (before making any changes) */
     if ((uri == NULL) || ((first == NULL) != (afterLast == NULL))) {
         return URI_ERROR_NULL;
@@ -299,8 +298,8 @@ int URI_FUNC(SetPathMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
     URI_CHECK_MEMORY_MANAGER(memory); /* may return */

     if ((first != NULL)
-        && (URI_FUNC(IsWellFormedPath)(first, afterLast, URI_FUNC(HasHost)(uri))
-            == URI_FALSE)) {
+            && (URI_FUNC(IsWellFormedPath)(first, afterLast, URI_FUNC(HasHost)(uri))
+                    == URI_FALSE)) {
         return URI_ERROR_SYNTAX;
     }

@@ -331,12 +330,12 @@ int URI_FUNC(SetPathMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
     /* Apply new value */
     res = URI_FUNC(InternalSetPath)(uri, first, afterLast, memory);
     assert((res == URI_SUCCESS) || (res == URI_ERROR_SYNTAX)
-           || (res == URI_ERROR_MALLOC));
+            || (res == URI_ERROR_MALLOC));
     return res;
 }

-int URI_FUNC(SetPath)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                      const URI_CHAR * afterLast) {
+int URI_FUNC(SetPath)(
+        URI_TYPE(Uri) * uri, const URI_CHAR * first, const URI_CHAR * afterLast) {
     return URI_FUNC(SetPathMm)(uri, first, afterLast, NULL);
 }

diff --git a/ext/uri/uriparser/src/UriSetPort.c b/ext/uri/uriparser/src/UriSetPort.c
index 5e2160e3097..b6ed715eabf 100644
--- a/ext/uri/uriparser/src/UriSetPort.c
+++ b/ext/uri/uriparser/src/UriSetPort.c
@@ -86,7 +86,7 @@ UriBool URI_FUNC(IsWellFormedPort)(const URI_CHAR * first, const URI_CHAR * afte
 }

 int URI_FUNC(SetPortTextMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                            const URI_CHAR * afterLast, UriMemoryManager * memory) {
+        const URI_CHAR * afterLast, UriMemoryManager * memory) {
     /* Input validation (before making any changes) */
     if ((uri == NULL) || ((first == NULL) != (afterLast == NULL))) {
         return URI_ERROR_NULL;
@@ -141,8 +141,8 @@ int URI_FUNC(SetPortTextMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
     return URI_SUCCESS;
 }

-int URI_FUNC(SetPortText)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                          const URI_CHAR * afterLast) {
+int URI_FUNC(SetPortText)(
+        URI_TYPE(Uri) * uri, const URI_CHAR * first, const URI_CHAR * afterLast) {
     return URI_FUNC(SetPortTextMm)(uri, first, afterLast, NULL);
 }

diff --git a/ext/uri/uriparser/src/UriSetQuery.c b/ext/uri/uriparser/src/UriSetQuery.c
index 4f58c8286ed..18560bb154e 100644
--- a/ext/uri/uriparser/src/UriSetQuery.c
+++ b/ext/uri/uriparser/src/UriSetQuery.c
@@ -116,7 +116,7 @@ UriBool URI_FUNC(IsWellFormedQuery)(const URI_CHAR * first, const URI_CHAR * aft
 }

 int URI_FUNC(SetQueryMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                         const URI_CHAR * afterLast, UriMemoryManager * memory) {
+        const URI_CHAR * afterLast, UriMemoryManager * memory) {
     /* Input validation (before making any changes) */
     if ((uri == NULL) || ((first == NULL) != (afterLast == NULL))) {
         return URI_ERROR_NULL;
@@ -164,8 +164,8 @@ int URI_FUNC(SetQueryMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
     return URI_SUCCESS;
 }

-int URI_FUNC(SetQuery)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                       const URI_CHAR * afterLast) {
+int URI_FUNC(SetQuery)(
+        URI_TYPE(Uri) * uri, const URI_CHAR * first, const URI_CHAR * afterLast) {
     return URI_FUNC(SetQueryMm)(uri, first, afterLast, NULL);
 }

diff --git a/ext/uri/uriparser/src/UriSetScheme.c b/ext/uri/uriparser/src/UriSetScheme.c
index 3dfaf1e9f15..9baa19d1285 100644
--- a/ext/uri/uriparser/src/UriSetScheme.c
+++ b/ext/uri/uriparser/src/UriSetScheme.c
@@ -109,7 +109,7 @@ UriBool URI_FUNC(IsWellFormedScheme)(const URI_CHAR * first, const URI_CHAR * af
 }

 int URI_FUNC(SetSchemeMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                          const URI_CHAR * afterLast, UriMemoryManager * memory) {
+        const URI_CHAR * afterLast, UriMemoryManager * memory) {
     /* Input validation (before making any changes) */
     if ((uri == NULL) || ((first == NULL) != (afterLast == NULL))) {
         return URI_ERROR_NULL;
@@ -118,7 +118,7 @@ int URI_FUNC(SetSchemeMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
     URI_CHECK_MEMORY_MANAGER(memory); /* may return */

     if ((first != NULL)
-        && (URI_FUNC(IsWellFormedScheme)(first, afterLast) == URI_FALSE)) {
+            && (URI_FUNC(IsWellFormedScheme)(first, afterLast) == URI_FALSE)) {
         return URI_ERROR_SYNTAX;
     }

@@ -160,8 +160,8 @@ int URI_FUNC(SetSchemeMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
     return URI_SUCCESS;
 }

-int URI_FUNC(SetScheme)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                        const URI_CHAR * afterLast) {
+int URI_FUNC(SetScheme)(
+        URI_TYPE(Uri) * uri, const URI_CHAR * first, const URI_CHAR * afterLast) {
     return URI_FUNC(SetSchemeMm)(uri, first, afterLast, NULL);
 }

diff --git a/ext/uri/uriparser/src/UriSetUserInfo.c b/ext/uri/uriparser/src/UriSetUserInfo.c
index 7865e837deb..93b26af6ec7 100644
--- a/ext/uri/uriparser/src/UriSetUserInfo.c
+++ b/ext/uri/uriparser/src/UriSetUserInfo.c
@@ -67,8 +67,8 @@

 #  include <assert.h>

-UriBool URI_FUNC(IsWellFormedUserInfo)(const URI_CHAR * first,
-                                       const URI_CHAR * afterLast) {
+UriBool URI_FUNC(IsWellFormedUserInfo)(
+        const URI_CHAR * first, const URI_CHAR * afterLast) {
     if ((first == NULL) || (afterLast == NULL)) {
         return URI_FALSE;
     }
@@ -116,7 +116,7 @@ UriBool URI_FUNC(IsWellFormedUserInfo)(const URI_CHAR * first,
 }

 int URI_FUNC(SetUserInfoMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                            const URI_CHAR * afterLast, UriMemoryManager * memory) {
+        const URI_CHAR * afterLast, UriMemoryManager * memory) {
     /* Input validation (before making any changes) */
     if ((uri == NULL) || ((first == NULL) != (afterLast == NULL))) {
         return URI_ERROR_NULL;
@@ -132,7 +132,7 @@ int URI_FUNC(SetUserInfoMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
     }

     if ((first != NULL)
-        && (URI_FUNC(IsWellFormedUserInfo)(first, afterLast) == URI_FALSE)) {
+            && (URI_FUNC(IsWellFormedUserInfo)(first, afterLast) == URI_FALSE)) {
         return URI_ERROR_SYNTAX;
     }

@@ -172,8 +172,8 @@ int URI_FUNC(SetUserInfoMm)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
     return URI_SUCCESS;
 }

-int URI_FUNC(SetUserInfo)(URI_TYPE(Uri) * uri, const URI_CHAR * first,
-                          const URI_CHAR * afterLast) {
+int URI_FUNC(SetUserInfo)(
+        URI_TYPE(Uri) * uri, const URI_CHAR * first, const URI_CHAR * afterLast) {
     return URI_FUNC(SetUserInfoMm)(uri, first, afterLast, NULL);
 }

diff --git a/ext/uri/uriparser/src/UriShorten.c b/ext/uri/uriparser/src/UriShorten.c
index 001bd7db999..3a024d2d2a1 100644
--- a/ext/uri/uriparser/src/UriShorten.c
+++ b/ext/uri/uriparser/src/UriShorten.c
@@ -66,12 +66,10 @@
 #  endif

 static URI_INLINE UriBool URI_FUNC(AppendSegment)(URI_TYPE(Uri) * uri,
-                                                  const URI_CHAR * first,
-                                                  const URI_CHAR * afterLast,
-                                                  UriMemoryManager * memory) {
+        const URI_CHAR * first, const URI_CHAR * afterLast, UriMemoryManager * memory) {
     /* Create segment */
     URI_TYPE(PathSegment) * segment =
-        memory->malloc(memory, 1 * sizeof(URI_TYPE(PathSegment)));
+            memory->malloc(memory, 1 * sizeof(URI_TYPE(PathSegment)));
     if (segment == NULL) {
         return URI_FALSE; /* Raises malloc error */
     }
@@ -90,31 +88,33 @@ static URI_INLINE UriBool URI_FUNC(AppendSegment)(URI_TYPE(Uri) * uri,
     return URI_TRUE;
 }

-static URI_INLINE UriBool URI_FUNC(EqualsAuthority)(const URI_TYPE(Uri) * first,
-                                                    const URI_TYPE(Uri) * second) {
+static URI_INLINE UriBool URI_FUNC(EqualsAuthority)(
+        const URI_TYPE(Uri) * first, const URI_TYPE(Uri) * second) {
     /* IPv4 */
     if (first->hostData.ip4 != NULL) {
         return ((second->hostData.ip4 != NULL)
-                && !memcmp(first->hostData.ip4->data, second->hostData.ip4->data, 4))
-                   ? URI_TRUE
-                   : URI_FALSE;
+                       && !memcmp(
+                               first->hostData.ip4->data, second->hostData.ip4->data, 4))
+                       ? URI_TRUE
+                       : URI_FALSE;
     }

     /* IPv6 */
     if (first->hostData.ip6 != NULL) {
         return ((second->hostData.ip6 != NULL)
-                && !memcmp(first->hostData.ip6->data, second->hostData.ip6->data, 16))
-                   ? URI_TRUE
-                   : URI_FALSE;
+                       && !memcmp(
+                               first->hostData.ip6->data, second->hostData.ip6->data, 16))
+                       ? URI_TRUE
+                       : URI_FALSE;
     }

     /* IPvFuture */
     if (first->hostData.ipFuture.first != NULL) {
         return ((second->hostData.ipFuture.first != NULL)
-                && URI_FUNC(RangeEquals)(&first->hostData.ipFuture,
-                                         &second->hostData.ipFuture))
-                   ? URI_TRUE
-                   : URI_FALSE;
+                       && URI_FUNC(RangeEquals)(
+                               &first->hostData.ipFuture, &second->hostData.ipFuture))
+                       ? URI_TRUE
+                       : URI_FALSE;
     }

     return URI_FUNC(RangeEquals)(&first->hostText, &second->hostText) ? URI_TRUE
@@ -122,10 +122,8 @@ static URI_INLINE UriBool URI_FUNC(EqualsAuthority)(const URI_TYPE(Uri) * first,
 }

 static int URI_FUNC(RemoveBaseUriImpl)(URI_TYPE(Uri) * dest,
-                                       const URI_TYPE(Uri) * absSource,
-                                       const URI_TYPE(Uri) * absBase,
-                                       UriBool domainRootMode,
-                                       UriMemoryManager * memory) {
+        const URI_TYPE(Uri) * absSource, const URI_TYPE(Uri) * absBase,
+        UriBool domainRootMode, UriMemoryManager * memory) {
     if (dest == NULL) {
         return URI_ERROR_NULL;
     }
@@ -253,12 +251,13 @@ static int URI_FUNC(RemoveBaseUriImpl)(URI_TYPE(Uri) * dest,
                             /* clang-format off */
     /* [22/50]          while (first(A.path) == first(Base.path)) do */
                             /* clang-format on */
-                            while (
-                                (sourceSeg != NULL) && (baseSeg != NULL)
-                                && URI_FUNC(RangeEquals)(&sourceSeg->text, &baseSeg->text)
-                                && !((sourceSeg->text.first == sourceSeg->text.afterLast)
-                                     && ((sourceSeg->next == NULL)
-                                         != (baseSeg->next == NULL)))) {
+                            while ((sourceSeg != NULL) && (baseSeg != NULL)
+                                    && URI_FUNC(RangeEquals)(
+                                            &sourceSeg->text, &baseSeg->text)
+                                    && !((sourceSeg->text.first
+                                                 == sourceSeg->text.afterLast)
+                                            && ((sourceSeg->next == NULL)
+                                                    != (baseSeg->next == NULL)))) {
                                 /* clang-format off */
     /* [23/50]             A.path++; */
                                 /* clang-format on */
@@ -283,8 +282,7 @@ static int URI_FUNC(RemoveBaseUriImpl)(URI_TYPE(Uri) * dest,
     /* [28/50]             T.path += "../"; */
                                 /* clang-format on */
                                 if (!URI_FUNC(AppendSegment)(dest, URI_FUNC(ConstParent),
-                                                             URI_FUNC(ConstParent) + 2,
-                                                             memory)) {
+                                            URI_FUNC(ConstParent) + 2, memory)) {
                                     return URI_ERROR_MALLOC;
                                 }
                                 /* clang-format off */
@@ -319,9 +317,9 @@ static int URI_FUNC(RemoveBaseUriImpl)(URI_TYPE(Uri) * dest,
                                         /* clang-format off */
     /* [34/50]                   T.path += "./"; */
                                         /* clang-format on */
-                                        if (!URI_FUNC(AppendSegment)(
-                                                dest, URI_FUNC(ConstPwd),
-                                                URI_FUNC(ConstPwd) + 1, memory)) {
+                                        if (!URI_FUNC(AppendSegment)(dest,
+                                                    URI_FUNC(ConstPwd),
+                                                    URI_FUNC(ConstPwd) + 1, memory)) {
                                             return URI_ERROR_MALLOC;
                                         }
                                         /* clang-format off */
@@ -332,9 +330,9 @@ static int URI_FUNC(RemoveBaseUriImpl)(URI_TYPE(Uri) * dest,
                                         /* clang-format off */
     /* [36/50]                   T.path += "/."; */
                                         /* clang-format on */
-                                        if (!URI_FUNC(AppendSegment)(
-                                                dest, URI_FUNC(ConstPwd),
-                                                URI_FUNC(ConstPwd) + 1, memory)) {
+                                        if (!URI_FUNC(AppendSegment)(dest,
+                                                    URI_FUNC(ConstPwd),
+                                                    URI_FUNC(ConstPwd) + 1, memory)) {
                                             return URI_ERROR_MALLOC;
                                         }
                                         /* clang-format off */
@@ -349,8 +347,7 @@ static int URI_FUNC(RemoveBaseUriImpl)(URI_TYPE(Uri) * dest,
     /* [39/50]             T.path += first(A.path); */
                                 /* clang-format on */
                                 if (!URI_FUNC(AppendSegment)(dest, sourceSeg->text.first,
-                                                             sourceSeg->text.afterLast,
-                                                             memory)) {
+                                            sourceSeg->text.afterLast, memory)) {
                                     return URI_ERROR_MALLOC;
                                 }
                                 /* clang-format off */
@@ -404,13 +401,13 @@ static int URI_FUNC(RemoveBaseUriImpl)(URI_TYPE(Uri) * dest,
 }

 int URI_FUNC(RemoveBaseUri)(URI_TYPE(Uri) * dest, const URI_TYPE(Uri) * absSource,
-                            const URI_TYPE(Uri) * absBase, UriBool domainRootMode) {
+        const URI_TYPE(Uri) * absBase, UriBool domainRootMode) {
     return URI_FUNC(RemoveBaseUriMm)(dest, absSource, absBase, domainRootMode, NULL);
 }

 int URI_FUNC(RemoveBaseUriMm)(URI_TYPE(Uri) * dest, const URI_TYPE(Uri) * absSource,
-                              const URI_TYPE(Uri) * absBase, UriBool domainRootMode,
-                              UriMemoryManager * memory) {
+        const URI_TYPE(Uri) * absBase, UriBool domainRootMode,
+        UriMemoryManager * memory) {
     int res;

     URI_CHECK_MEMORY_MANAGER(memory); /* may return */