[前][次][番号順一覧][スレッド一覧]

ruby-changes:12822

From: nobu <ko1@a...>
Date: Sun, 16 Aug 2009 11:15:29 +0900 (JST)
Subject: [ruby-changes:12822] Ruby:r24551 (trunk): * regparse.c: commit miss.

nobu	2009-08-16 11:15:13 +0900 (Sun, 16 Aug 2009)

  New Revision: 24551

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=24551

  Log:
    * regparse.c: commit miss.

  Modified files:
    trunk/regparse.c

Index: regparse.c
===================================================================
--- regparse.c	(revision 24550)
+++ regparse.c	(revision 24551)
@@ -335,11 +335,11 @@
   return 0;
 }
 
-static int
+static st_index_t
 str_end_hash(st_str_end_key* x)
 {
   UChar *p;
-  int val = 0;
+  st_index_t val = 0;
 
   p = x->s;
   while (p < x->end) {
@@ -350,7 +350,7 @@
 }
 
 extern hash_table_type*
-onig_st_init_strend_table_with_size(int size)
+onig_st_init_strend_table_with_size(st_index_t size)
 {
   static const struct st_hash_type hashType = {
     str_end_cmp,
@@ -4548,7 +4548,6 @@
  err:
   if (cc != NCCLASS(*np))
     bbuf_free(cc->mbuf);
-  onig_node_free(*np);
   return r;
 }
 
@@ -4782,7 +4781,10 @@
   r = fetch_token(tok, &p, end, env);
   if (r < 0) return r;
   r = parse_subexp(&target, tok, term, &p, end, env);
-  if (r < 0) return r;
+  if (r < 0) {
+    onig_node_free(target);
+    return r;
+  }
 
   if (NTYPE(*np) == NT_ANCHOR)
     NANCHOR(*np)->target = target;
@@ -4918,7 +4920,7 @@
   return 0;
 }
 
-static int type_cclass_hash(type_cclass_key* key)
+static st_index_t type_cclass_hash(type_cclass_key* key)
 {
   int i, val;
   UChar *p;
@@ -5121,7 +5123,10 @@
       if (r < 0) goto err;
       r = parse_subexp(&target, tok, term, src, end, env);
       env->option = prev;
-      if (r < 0) goto err;
+      if (r < 0) {
+	onig_node_free(target);
+	return r;
+      }
       NENCLOSE(*np)->target = target;
       return tok->type;
     }
@@ -5495,7 +5500,10 @@
 
   *top = NULL;
   r = parse_exp(&node, tok, term, src, end, env);
-  if (r < 0) return r;
+  if (r < 0) {
+    onig_node_free(node);
+    return r;
+  }
 
   if (r == TK_EOT || r == term || r == TK_ALT) {
     *top = node;
@@ -5506,7 +5514,7 @@
     while (r != TK_EOT && r != term && r != TK_ALT) {
       r = parse_exp(&node, tok, term, src, end, env);
       if (r < 0) {
-	onig_node_free(*top);
+	onig_node_free(node);
 	return r;
       }
 
@@ -5551,7 +5559,7 @@
       }
       r = parse_branch(&node, tok, term, src, end, env);
       if (r < 0) {
-	onig_node_free(*top);
+	onig_node_free(node);
 	return r;
       }
 
@@ -5565,6 +5573,7 @@
     }
   }
   else {
+    onig_node_free(node);
   err:
     if (term == TK_SUBEXP_CLOSE)
       return ONIGERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]