Upgrade pcre to pcre2-10.39

Test: make
Change-Id: I05a74df534efc6d9303ad035797fcf19e9c82bcd
diff --git a/src/pcre2grep.c b/src/pcre2grep.c
index f233c1d..aa84ea7 100644
--- a/src/pcre2grep.c
+++ b/src/pcre2grep.c
@@ -110,17 +110,18 @@
 #define snprintf _snprintf
 #endif
 
-/* VC and older compilers don't support %td or %zu, and even some that claim to
+/* old VC and older compilers don't support %td or %zu, and even some that claim to
 be C99 don't support it (hence DISABLE_PERCENT_ZT). */
 
-#if defined(_MSC_VER) || !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L || defined(DISABLE_PERCENT_ZT)
-#define PTR_FORM "lu"
-#define SIZ_FORM "lu"
-#define SIZ_CAST (unsigned long int)
+#if defined(DISABLE_PERCENT_ZT) || (defined(_MSC_VER) && (_MSC_VER < 1800)) || \
+  (!defined(_MSC_VER) && (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L))
+#ifdef _WIN64
+#define SIZ_FORM "llu"
 #else
-#define PTR_FORM "td"
+#define SIZ_FORM "lu"
+#endif
+#else
 #define SIZ_FORM "zu"
-#define SIZ_CAST
 #endif
 
 #define FALSE 0
@@ -1856,8 +1857,7 @@
     unsigned char mbuffer[256];
     PCRE2_SIZE startchar = pcre2_get_startchar(match_data);
     (void)pcre2_get_error_message(*mrc, mbuffer, sizeof(mbuffer));
-    fprintf(stderr, "%s at offset %" SIZ_FORM "\n\n", mbuffer,
-      SIZ_CAST startchar);
+    fprintf(stderr, "%s at offset %" SIZ_FORM "\n\n", mbuffer, startchar);
     }
   if (*mrc == PCRE2_ERROR_MATCHLIMIT || *mrc == PCRE2_ERROR_DEPTHLIMIT ||
       *mrc == PCRE2_ERROR_HEAPLIMIT || *mrc == PCRE2_ERROR_JIT_STACKLIMIT)
@@ -3361,18 +3361,23 @@
       because that affects the output from pcre2grep. */
 
 #ifdef HAVE_REALPATH
+      {
       char resolvedpath[PATH_MAX];
+      BOOL isSame;
+      size_t rlen;
       if (realpath(childpath, resolvedpath) == NULL)
         continue;     /* This path is invalid - we can skip processing this */
-      BOOL isSame = strcmp(pathname, resolvedpath) == 0;
+      isSame = strcmp(pathname, resolvedpath) == 0;
       if (isSame) continue;    /* We have a recursion */
-      size_t rlen = strlen(resolvedpath);
+      rlen = strlen(resolvedpath);
       if (rlen++ < sizeof(resolvedpath) - 3)
         {
+        BOOL contained;
         strcat(resolvedpath, "/");
-        BOOL contained = strncmp(pathname, resolvedpath, rlen) == 0;
+        contained = strncmp(pathname, resolvedpath, rlen) == 0;
         if (contained) continue;    /* We have a recursion */
         }
+      }
 #endif  /* HAVE_REALPATH */
 
       frc = grep_or_recurse(childpath, dir_recurse, FALSE);