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

ruby-changes:38837

From: nobu <ko1@a...>
Date: Tue, 16 Jun 2015 18:46:09 +0900 (JST)
Subject: [ruby-changes:38837] nobu:r50918 (trunk): date_strptime.c: use ALLOCV

nobu	2015-06-16 18:45:50 +0900 (Tue, 16 Jun 2015)

  New Revision: 50918

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

  Log:
    date_strptime.c: use ALLOCV
    
    * ext/date/date_strptime.c (read_digits): use ALLOCV instead of
      ALLOCA get rid of stack overflow.

  Modified files:
    trunk/ext/date/date_strptime.c
Index: ext/date/date_strptime.c
===================================================================
--- ext/date/date_strptime.c	(revision 50917)
+++ ext/date/date_strptime.c	(revision 50918)
@@ -103,10 +103,12 @@ read_digits(const char *s, VALUE *n, siz https://github.com/ruby/ruby/blob/trunk/ext/date/date_strptime.c#L103
 	return l;
     }
     else {
-	char *s2 = ALLOCA_N(char, l + 1);
+	VALUE vbuf = 0;
+	char *s2 = ALLOCV_N(char, vbuf, l + 1);
 	memcpy(s2, s, l);
 	s2[l] = '\0';
 	*n = rb_cstr_to_inum(s2, 10, 0);
+	ALLOCV_END(vbuf);
 	return l;
     }
 }

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

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