]> granicus.if.org Git - onig/commitdiff
rename positive_int_multiply() to onig_positive_int_multiply()
authorK.Kosako <kosako@sofnec.co.jp>
Wed, 12 Sep 2018 01:54:24 +0000 (10:54 +0900)
committerK.Kosako <kosako@sofnec.co.jp>
Wed, 12 Sep 2018 01:54:24 +0000 (10:54 +0900)
src/regcomp.c
src/regint.h
src/regparse.c

index ee534ed93596782e546f4d52fd422dbbbaec22a4..7f382c8f6271b490ae81b3e085ccca757c93a6cc 100644 (file)
@@ -138,6 +138,17 @@ int_multiply_cmp(int x, int y, int v)
     return 1;
 }
 
+extern int
+onig_positive_int_multiply(int x, int y)
+{
+  if (x == 0 || y == 0) return 0;
+
+  if (x < INT_MAX / y)
+    return x * y;
+  else
+    return -1;
+}
+
 
 #ifndef PLATFORM_UNALIGNED_WORD_ACCESS
 static unsigned char PadBuf[WORD_ALIGNMENT_SIZE];
index cb7cd11eaef7f909ab8d6e93e4ce29d4a1879691..09a4676eefc752af9c1846bdff6cad786a6134f0 100644 (file)
@@ -841,6 +841,7 @@ extern void   onig_transfer P_((regex_t* to, regex_t* from));
 extern int    onig_is_code_in_cc_len P_((int enclen, OnigCodePoint code, void* /* CClassNode* */ cc));
 extern RegexExt* onig_get_regex_ext(regex_t* reg);
 extern int    onig_ext_set_pattern(regex_t* reg, const UChar* pattern, const UChar* pattern_end);
+extern int    onig_positive_int_multiply(int x, int y);
 
 #ifdef USE_CALLOUT
 
index 433da2021fd822a038bb3f9cd46c0b079fc15a7f..edca44e2059d7155de8369142f3ee362f0519b5a 100644 (file)
@@ -198,17 +198,6 @@ onig_set_parse_depth_limit(unsigned int depth)
   return 0;
 }
 
-static int
-positive_int_multiply(int x, int y)
-{
-  if (x == 0 || y == 0) return 0;
-
-  if (x < INT_MAX / y)
-    return x * y;
-  else
-    return -1;
-}
-
 static void
 bbuf_free(BBuf* bbuf)
 {
@@ -3877,7 +3866,7 @@ onig_reduce_nested_quantifier(Node* pnode, Node* cnode)
   if (pnum < 0 || cnum < 0) {
     if ((p->lower == p->upper) && ! IS_REPEAT_INFINITE(p->upper)) {
       if ((c->lower == c->upper) && ! IS_REPEAT_INFINITE(c->upper)) {
-        int n = positive_int_multiply(p->lower, c->lower);
+        int n = onig_positive_int_multiply(p->lower, c->lower);
         if (n >= 0) {
           p->lower = p->upper = n;
           NODE_BODY(pnode) = NODE_BODY(cnode);