* ext/date/date_parse.c: should use ALLOCA_N.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
61a34d625e
commit
8ce62003a0
@ -1,3 +1,7 @@
|
|||||||
|
Mon Jun 27 08:01:19 2011 Tadayoshi Funaba <tadf@dotrb.org>
|
||||||
|
|
||||||
|
* ext/date/date_parse.c: should use ALLOCA_N.
|
||||||
|
|
||||||
Mon Jun 27 01:34:18 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Mon Jun 27 01:34:18 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* test/etc/test_etc.rb (TestEtc#test_get{pw,gr}nam): skip entries
|
* test/etc/test_etc.rb (TestEtc#test_get{pw,gr}nam): skip entries
|
||||||
|
@ -154,7 +154,7 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc)
|
|||||||
{
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
buf = ALLOC_N(char, ep - bp + 1);
|
buf = ALLOCA_N(char, ep - bp + 1);
|
||||||
memcpy(buf, bp, ep - bp);
|
memcpy(buf, bp, ep - bp);
|
||||||
buf[ep - bp] = '\0';
|
buf[ep - bp] = '\0';
|
||||||
iy = cstr2num(buf);
|
iy = cstr2num(buf);
|
||||||
@ -178,7 +178,7 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc)
|
|||||||
{
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
buf = ALLOC_N(char, ep - bp + 1);
|
buf = ALLOCA_N(char, ep - bp + 1);
|
||||||
memcpy(buf, bp, ep - bp);
|
memcpy(buf, bp, ep - bp);
|
||||||
buf[ep - bp] = '\0';
|
buf[ep - bp] = '\0';
|
||||||
im = cstr2num(buf);
|
im = cstr2num(buf);
|
||||||
@ -200,7 +200,7 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc)
|
|||||||
{
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
buf = ALLOC_N(char, ep - bp + 1);
|
buf = ALLOCA_N(char, ep - bp + 1);
|
||||||
memcpy(buf, bp, ep - bp);
|
memcpy(buf, bp, ep - bp);
|
||||||
buf[ep - bp] = '\0';
|
buf[ep - bp] = '\0';
|
||||||
id = cstr2num(buf);
|
id = cstr2num(buf);
|
||||||
@ -358,7 +358,7 @@ date_zone_to_diff(VALUE str)
|
|||||||
l = RSTRING_LEN(str);
|
l = RSTRING_LEN(str);
|
||||||
s = RSTRING_PTR(str);
|
s = RSTRING_PTR(str);
|
||||||
|
|
||||||
dest = d = ALLOC_N(char, l + 1);
|
dest = d = ALLOCA_N(char, l + 1);
|
||||||
|
|
||||||
for (i = 0; i < l; i++) {
|
for (i = 0; i < l; i++) {
|
||||||
if (isspace(s[i]) || s[i] == '\0') {
|
if (isspace(s[i]) || s[i] == '\0') {
|
||||||
@ -472,7 +472,7 @@ date_zone_to_diff(VALUE str)
|
|||||||
if (strpbrk(RSTRING_PTR(str), ",.")) {
|
if (strpbrk(RSTRING_PTR(str), ",.")) {
|
||||||
char *a, *b;
|
char *a, *b;
|
||||||
|
|
||||||
a = ALLOC_N(char, RSTRING_LEN(str) + 1);
|
a = ALLOCA_N(char, RSTRING_LEN(str) + 1);
|
||||||
strcpy(a, RSTRING_PTR(str));
|
strcpy(a, RSTRING_PTR(str));
|
||||||
b = strpbrk(a, ",.");
|
b = strpbrk(a, ",.");
|
||||||
*b = '\0';
|
*b = '\0';
|
||||||
@ -1368,7 +1368,7 @@ parse_ddd_cb(VALUE m, VALUE hash)
|
|||||||
set_hash("zone", s5);
|
set_hash("zone", s5);
|
||||||
|
|
||||||
if (*cs5 == '[') {
|
if (*cs5 == '[') {
|
||||||
char *buf = ALLOC_N(char, l5 + 1);
|
char *buf = ALLOCA_N(char, l5 + 1);
|
||||||
char *s1, *s2, *s3;
|
char *s1, *s2, *s3;
|
||||||
VALUE zone;
|
VALUE zone;
|
||||||
|
|
||||||
@ -1521,8 +1521,8 @@ date__parse(VALUE str, VALUE comp)
|
|||||||
static const char pat_source[] = "[^-+',./:@[:alnum:]\\[\\]]+";
|
static const char pat_source[] = "[^-+',./:@[:alnum:]\\[\\]]+";
|
||||||
static VALUE pat = Qnil;
|
static VALUE pat = Qnil;
|
||||||
|
|
||||||
str = rb_str_dup(str);
|
|
||||||
REGCOMP_0(pat);
|
REGCOMP_0(pat);
|
||||||
|
str = rb_str_dup(str);
|
||||||
f_gsub_bang(str, pat, asp_string());
|
f_gsub_bang(str, pat, asp_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user