summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-21 10:25:40 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-21 10:25:40 +0000
commit90be342c9ffac1f2d23e672911b0499a8cd5bac9 (patch)
tree9d7a8a20afa342f897efa3fdddac7aec6517b3c5
parentde928040818eba82d7f1ca239244c80895c5da43 (diff)
downloadruby-90be342c9ffac1f2d23e672911b0499a8cd5bac9.tar.gz
* 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
-rw-r--r--ChangeLog5
-rw-r--r--pack.c23
2 files changed, 20 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index efaf430c25..ed1e534f7d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
* include/ruby/ruby.h, re.c: support write barrier for T_REGEXP.
diff --git a/pack.c b/pack.c
index 8712afa548..afeb843e1b 100644
--- a/pack.c
+++ b/pack.c
@@ -669,14 +669,9 @@ pack_pack(VALUE ary, VALUE fmt)
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)
}
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) {