summaryrefslogtreecommitdiff
path: root/pack.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-06-26 09:45:09 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-06-26 09:45:09 +0000
commit05da25f297c4d26b6bb454a9649b1dd63a102910 (patch)
tree568d1118ca9c2c7bfbcaf2d2132a7e870367d407 /pack.c
parent839f4c5f3fdb4ea6b270fce17f1c3881060087d4 (diff)
980626
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'pack.c')
-rw-r--r--pack.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/pack.c b/pack.c
index 400d81c8b9..840b837ce5 100644
--- a/pack.c
+++ b/pack.c
@@ -103,10 +103,9 @@ pack_pack(ary, fmt)
char *ptr;
int plen;
- Check_Type(fmt, T_STRING);
-
- p = RSTRING(fmt)->ptr;
- pend = RSTRING(fmt)->ptr + RSTRING(fmt)->len;
+
+ p = str2cstr(fmt, &plen);
+ pend = p + plen;
res = str_new(0, 0);
items = RARRAY(ary)->len;
@@ -551,12 +550,10 @@ pack_unpack(str, fmt)
char type;
int len;
- Check_Type(fmt, T_STRING);
-
- s = RSTRING(str)->ptr;
- send = s + RSTRING(str)->len;
- p = RSTRING(fmt)->ptr;
- pend = p + RSTRING(fmt)->len;
+ s = str2cstr(str, &len);
+ send = s + len;
+ p = str2cstr(fmt, &len);
+ pend = p + len;
ary = ary_new();
while (p < pend) {