static void Factory_free(msgpack_factory_t* fc) { if(fc == NULL) { return; } msgpack_packer_ext_registry_destroy(&fc->pkrg); msgpack_unpacker_ext_registry_destroy(&fc->ukrg); xfree(fc); }
static void Unpacker_free(msgpack_unpacker_t* uk) { if(uk == NULL) { return; } msgpack_unpacker_ext_registry_destroy(&uk->ext_registry); _msgpack_unpacker_destroy(uk); free(uk); }
VALUE MessagePack_Factory_unpacker(int argc, VALUE* argv, VALUE self) { FACTORY(self, fc); VALUE unpacker = MessagePack_Unpacker_alloc(cMessagePack_Unpacker); MessagePack_Unpacker_initialize(argc, argv, unpacker); msgpack_unpacker_t* uk; Data_Get_Struct(unpacker, msgpack_unpacker_t, uk); msgpack_unpacker_ext_registry_destroy(&uk->ext_registry); msgpack_unpacker_ext_registry_dup(&fc->ukrg, &uk->ext_registry); return unpacker; }