summaryrefslogtreecommitdiff
path: root/cpp/unpack.cpp
diff options
context:
space:
mode:
authorfrsyuki <frsyuki@users.sourceforge.jp>2009-02-15 18:39:30 +0900
committerfrsyuki <frsyuki@users.sourceforge.jp>2009-02-15 18:39:30 +0900
commit761b3980834e4644ce0ce57f6db13d1c93883380 (patch)
tree78441655efcc1f8a18a25f9455562c774b55d1b0 /cpp/unpack.cpp
parent6083300ea949855e1b2cd3cc4e92bf340c4e90e7 (diff)
downloadmsgpack-python-761b3980834e4644ce0ce57f6db13d1c93883380.tar.gz
rewrite msgpack::object::via
Diffstat (limited to 'cpp/unpack.cpp')
-rw-r--r--cpp/unpack.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/cpp/unpack.cpp b/cpp/unpack.cpp
index 62088d6..0b9a476 100644
--- a/cpp/unpack.cpp
+++ b/cpp/unpack.cpp
@@ -104,36 +104,36 @@ static inline object msgpack_unpack_array(unpack_user* u, unsigned int n)
{
object o;
o.type = type::ARRAY;
- o.via.container.size = 0;
- o.via.container.ptr = (object*)u->z->malloc(n*sizeof(object));
+ o.via.array.size = 0;
+ o.via.array.ptr = (object*)u->z->malloc(n*sizeof(object));
return o;
}
static inline void msgpack_unpack_array_item(unpack_user* u, object* c, object o)
-{ c->via.container.ptr[ c->via.container.size++ ] = o; }
+{ c->via.array.ptr[c->via.array.size++] = o; }
static inline object msgpack_unpack_map(unpack_user* u, unsigned int n)
{
object o;
o.type = type::MAP;
- o.via.container.size = 0;
- o.via.container.ptr = (object*)u->z->malloc(n*2*sizeof(object));
+ o.via.map.size = 0;
+ o.via.map.ptr = (object_kv*)u->z->malloc(n*sizeof(object_kv));
return o;
}
static inline void msgpack_unpack_map_item(unpack_user* u, object* c, object k, object v)
{
- c->via.container.ptr[ c->via.container.size ] = k;
- c->via.container.ptr[ c->via.container.size+1 ] = v;
- ++c->via.container.size;
+ c->via.map.ptr[c->via.map.size].key = k;
+ c->via.map.ptr[c->via.map.size].val = v;
+ ++c->via.map.size;
}
static inline object msgpack_unpack_raw(unpack_user* u, const char* b, const char* p, unsigned int l)
{
object o;
o.type = type::RAW;
- o.via.ref.ptr = p;
- o.via.ref.size = l;
+ o.via.raw.ptr = p;
+ o.via.raw.size = l;
u->referenced = true;
return o;
}
@@ -332,7 +332,7 @@ object unpacker::data()
void unpacker::reset()
{
- if(!m_zone->empty()) { delete release_zone(); }
+ //if(!m_zone->empty()) { delete release_zone(); }
as_ctx(m_ctx)->reset();
}