/* * Document-method: Array#to_msgpack * * call-seq: * array.to_msgpack(out = '') -> String * * Serializes the Array into raw bytes. * This calls to_msgpack method reflectively for internal elements. */ static VALUE MessagePack_Array_to_msgpack(int argc, VALUE *argv, VALUE self) { ARG_BUFFER(out, argc, argv); // FIXME check sizeof(long) > sizeof(unsigned int) && RARRAY_LEN(self) > UINT_MAX msgpack_pack_array(out, (unsigned int)RARRAY_LEN(self)); VALUE* p = RARRAY_PTR(self); VALUE* const pend = p + RARRAY_LEN(self); for(;p != pend; ++p) { rb_funcall(*p, s_to_msgpack, 1, out); } return out; }