diff options
Diffstat (limited to 'pack.c')
-rw-r--r-- | pack.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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; } |