diff options
author | inada-n <songofacandy@gmail.com> | 2009-12-17 15:19:18 +0900 |
---|---|---|
committer | inada-n <songofacandy@gmail.com> | 2009-12-17 15:19:18 +0900 |
commit | 658c90f132d9582ec1e8ec68a30f9e67b8d7a572 (patch) | |
tree | 76d207312aed6d8043973af4cbcb090ccbf986b2 /msgpack/unpack.h | |
parent | 77e3e59620d65589451c833fa01e9c9e5f39624d (diff) | |
download | msgpack-python-658c90f132d9582ec1e8ec68a30f9e67b8d7a572.tar.gz |
Make tuple default.
Diffstat (limited to 'msgpack/unpack.h')
-rw-r--r-- | msgpack/unpack.h | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/msgpack/unpack.h b/msgpack/unpack.h index 0bf2568..61a3786 100644 --- a/msgpack/unpack.h +++ b/msgpack/unpack.h @@ -20,7 +20,7 @@ #include "unpack_define.h" typedef struct unpack_user { - int use_tuple; + int use_list; } unpack_user; @@ -136,7 +136,7 @@ static inline int template_callback_false(unpack_user* u, msgpack_unpack_object* static inline int template_callback_array(unpack_user* u, unsigned int n, msgpack_unpack_object* o) { - PyObject *p = u->use_tuple ? PyTuple_New(n) : PyList_New(n); + PyObject *p = u->use_list ? PyList_New(n) : PyTuple_New(n); if (!p) return -1; @@ -146,12 +146,10 @@ static inline int template_callback_array(unpack_user* u, unsigned int n, msgpac static inline int template_callback_array_item(unpack_user* u, unsigned int current, msgpack_unpack_object* c, msgpack_unpack_object o) { - if (u->use_tuple) { - PyTuple_SET_ITEM(*c, current, o); - } - else { + if (u->use_list) PyList_SET_ITEM(*c, current, o); - } + else + PyTuple_SET_ITEM(*c, current, o); return 0; } |