summaryrefslogtreecommitdiff
path: root/pack.c
diff options
context:
space:
mode:
Diffstat (limited to 'pack.c')
-rw-r--r--pack.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/pack.c b/pack.c
index caf829e22f..18de622c2b 100644
--- a/pack.c
+++ b/pack.c
@@ -331,7 +331,7 @@ pack_pack(ary, fmt)
static char *nul10 = "\0\0\0\0\0\0\0\0\0\0";
static char *spc10 = " ";
char *p, *pend;
- VALUE res, from;
+ VALUE res, from, associates = 0;
char type;
int items, len, idx;
char *ptr;
@@ -872,7 +872,10 @@ pack_pack(ary, fmt)
StringValue(from);
t = RSTRING(from)->ptr;
}
- rb_str_associate(res, from);
+ if (!associates) {
+ associates = rb_ary_new();
+ }
+ rb_ary_push(associates, from);
rb_str_buf_cat(res, (char*)&t, sizeof(char*));
}
break;
@@ -927,6 +930,10 @@ pack_pack(ary, fmt)
break;
}
}
+
+ if (associates) {
+ rb_str_associate(res, associates);
+ }
return res;
}