]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regposix.c
MdeModulePkg RegularExpressionDxe: Update Oniguruma from v6.9.0 to v6.9.3
[mirror_edk2.git] / MdeModulePkg / Universal / RegularExpressionDxe / Oniguruma / regposix.c
index 54d456424d7040c17c91852b107b7085eac13173..2bfe073ad094d180757a2cd87cec987e8ad5ef44 100644 (file)
@@ -2,7 +2,7 @@
   regposix.c - Oniguruma (regular expression library)\r
 **********************************************************************/\r
 /*-\r
- * Copyright (c) 2002-2018  K.Kosako  <sndgk393 AT ybb DOT ne DOT jp>\r
+ * Copyright (c) 2002-2019  K.Kosako  <sndgk393 AT ybb DOT ne DOT jp>\r
  * All rights reserved.\r
  *\r
  * Redistribution and use in source and binary forms, with or without\r
@@ -30,6 +30,7 @@
 #define regex_t   onig_regex_t\r
 #include "regint.h"\r
 #undef regex_t\r
+\r
 #include "onigposix.h"\r
 \r
 #define ONIG_C(reg)    ((onig_regex_t* )((reg)->onig))\r
@@ -148,6 +149,8 @@ regcomp(regex_t* reg, const char* pattern, int posix_options)
   OnigSyntaxType* syntax = OnigDefaultSyntax;\r
   OnigOptionType options;\r
 \r
+  reg->onig = (void* )0;\r
+\r
   if ((posix_options & REG_EXTENDED) == 0)\r
     syntax = ONIG_SYNTAX_POSIX_BASIC;\r
 \r
@@ -163,8 +166,8 @@ regcomp(regex_t* reg, const char* pattern, int posix_options)
 \r
   ENC_STRING_LEN(OnigEncDefaultCharEncoding, pattern, len);\r
   r = onig_new(PONIG_C(reg), (UChar* )pattern, (UChar* )(pattern + len),\r
-              options, OnigEncDefaultCharEncoding, syntax,\r
-              (OnigErrorInfo* )NULL);\r
+               options, OnigEncDefaultCharEncoding, syntax,\r
+               (OnigErrorInfo* )NULL);\r
   if (r != ONIG_NORMAL) {\r
     return onig2posix_error_code(r);\r
   }\r
@@ -175,7 +178,7 @@ regcomp(regex_t* reg, const char* pattern, int posix_options)
 \r
 extern int\r
 regexec(regex_t* reg, const char* str, size_t nmatch,\r
-       regmatch_t pmatch[], int posix_options)\r
+        regmatch_t pmatch[], int posix_options)\r
 {\r
   int r, i, len;\r
   UChar* end;\r
@@ -203,7 +206,7 @@ regexec(regex_t* reg, const char* str, size_t nmatch,
   ENC_STRING_LEN(ONIG_C(reg)->enc, str, len);\r
   end = (UChar* )(str + len);\r
   r = onig_search(ONIG_C(reg), (UChar* )str, end, (UChar* )str, end,\r
-                 (OnigRegion* )pm, options);\r
+                  (OnigRegion* )pm, options);\r
 \r
   if (r >= 0) {\r
     r = 0; /* Match */\r
@@ -235,6 +238,7 @@ extern void
 regfree(regex_t* reg)\r
 {\r
   onig_free(ONIG_C(reg));\r
+  reg->onig = (void* )0;\r
 }\r
 \r
 \r
@@ -272,7 +276,7 @@ typedef struct {
 \r
 static int\r
 i_wrapper(const UChar* name, const UChar* name_end, int ng, int* gs,\r
-         onig_regex_t* reg ARG_UNUSED, void* arg)\r
+          onig_regex_t* reg ARG_UNUSED, void* arg)\r
 {\r
   i_wrap* warg = (i_wrap* )arg;\r
 \r