ruby-changes:29480
From: akr <ko1@a...>
Date: Fri, 21 Jun 2013 19:25:54 +0900 (JST)
Subject: [ruby-changes:29480] akr:r41532 (trunk): * pack.c (pack_pack): Move the implementation for 'c' directive after
akr 2013-06-21 19:25:40 +0900 (Fri, 21 Jun 2013) New Revision: 41532 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41532 Log: * pack.c (pack_pack): Move the implementation for 'c' directive after pack_integer label. Modified files: trunk/ChangeLog trunk/pack.c Index: ChangeLog =================================================================== --- ChangeLog (revision 41531) +++ ChangeLog (revision 41532) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Jun 21 19:18:48 2013 Tanaka Akira <akr@f...> + + * pack.c (pack_pack): Move the implementation for 'c' directive after + pack_integer label. + Fri Jun 21 19:11:56 2013 Koichi Sasada <ko1@a...> * include/ruby/ruby.h, re.c: support write barrier for T_REGEXP. Index: pack.c =================================================================== --- pack.c (revision 41531) +++ pack.c (revision 41532) @@ -669,14 +669,9 @@ pack_pack(VALUE ary, VALUE fmt) https://github.com/ruby/ruby/blob/trunk/pack.c#L669 case 'c': /* signed char */ case 'C': /* unsigned char */ - while (len-- > 0) { - char c; - - from = NEXTFROM; - c = (char)num2i32(from); - rb_str_buf_cat(res, &c, sizeof(char)); - } - break; + integer_size = 1; + bigendian_p = BIGENDIAN_P(); /* not effective */ + goto pack_integer; case 's': /* s for int16_t, s! for signed short */ integer_size = NATINT_LEN(short, 2); @@ -744,6 +739,18 @@ pack_pack(VALUE ary, VALUE fmt) https://github.com/ruby/ruby/blob/trunk/pack.c#L739 } switch (integer_size) { +#if !defined(FORCE_BIG_PACK) + case 1: + while (len-- > 0) { + char c; + + from = NEXTFROM; + c = (char)num2i32(from); + rb_str_buf_cat(res, &c, sizeof(char)); + } + break; +#endif + #if defined(HAVE_INT16_T) && !defined(FORCE_BIG_PACK) case SIZEOF_INT16_T: while (len-- > 0) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/