* pack.c (pack_pack): Move the implementation for 'c' directive after

pack_integer label.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2013-06-21 10:25:40 +00:00
Родитель de92804081
Коммит 90be342c9f
2 изменённых файлов: 20 добавлений и 8 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Fri Jun 21 19:18:48 2013 Tanaka Akira <akr@fsij.org>
* pack.c (pack_pack): Move the implementation for 'c' directive after
pack_integer label.
Fri Jun 21 19:11:56 2013 Koichi Sasada <ko1@atdot.net> Fri Jun 21 19:11:56 2013 Koichi Sasada <ko1@atdot.net>
* include/ruby/ruby.h, re.c: support write barrier for T_REGEXP. * include/ruby/ruby.h, re.c: support write barrier for T_REGEXP.

23
pack.c
Просмотреть файл

@ -669,14 +669,9 @@ pack_pack(VALUE ary, VALUE fmt)
case 'c': /* signed char */ case 'c': /* signed char */
case 'C': /* unsigned char */ case 'C': /* unsigned char */
while (len-- > 0) { integer_size = 1;
char c; bigendian_p = BIGENDIAN_P(); /* not effective */
goto pack_integer;
from = NEXTFROM;
c = (char)num2i32(from);
rb_str_buf_cat(res, &c, sizeof(char));
}
break;
case 's': /* s for int16_t, s! for signed short */ case 's': /* s for int16_t, s! for signed short */
integer_size = NATINT_LEN(short, 2); integer_size = NATINT_LEN(short, 2);
@ -744,6 +739,18 @@ pack_pack(VALUE ary, VALUE fmt)
} }
switch (integer_size) { 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) #if defined(HAVE_INT16_T) && !defined(FORCE_BIG_PACK)
case SIZEOF_INT16_T: case SIZEOF_INT16_T:
while (len-- > 0) { while (len-- > 0) {