@@ -35,11 +35,6 @@ struct unpack_context {
3535 unsigned int cs ;
3636 unsigned int trail ;
3737 unsigned int top ;
38- /*
39- unpack_stack* stack;
40- unsigned int stack_size;
41- unpack_stack embed_stack[MSGPACK_EMBED_STACK_SIZE];
42- */
4338 unpack_stack stack [MSGPACK_EMBED_STACK_SIZE ];
4439};
4540
@@ -49,22 +44,9 @@ static inline void unpack_init(unpack_context* ctx)
4944 ctx -> cs = CS_HEADER ;
5045 ctx -> trail = 0 ;
5146 ctx -> top = 0 ;
52- /*
53- ctx->stack = ctx->embed_stack;
54- ctx->stack_size = MSGPACK_EMBED_STACK_SIZE;
55- */
56- ctx -> stack [0 ].obj = unpack_callback_root (& ctx -> user );
47+ ctx -> stack [0 ].obj = NULL ;
5748}
5849
59- /*
60- static inline void unpack_destroy(unpack_context* ctx)
61- {
62- if(ctx->stack_size != MSGPACK_EMBED_STACK_SIZE) {
63- free(ctx->stack);
64- }
65- }
66- */
67-
6850static inline PyObject * unpack_data (unpack_context * ctx )
6951{
7052 return (ctx )-> stack [0 ].obj ;
@@ -94,9 +76,6 @@ static inline int unpack_execute(bool construct, unpack_context* ctx, const char
9476 unsigned int cs = ctx -> cs ;
9577 unsigned int top = ctx -> top ;
9678 unpack_stack * stack = ctx -> stack ;
97- /*
98- unsigned int stack_size = ctx->stack_size;
99- */
10079 unpack_user * user = & ctx -> user ;
10180
10281 PyObject * obj = NULL ;
@@ -319,6 +298,7 @@ static inline int unpack_execute(bool construct, unpack_context* ctx, const char
319298 start_container (_map , _msgpack_load32 (uint32_t ,n ), CT_MAP_KEY );
320299
321300 default :
301+ PyErr_Format (PyExc_RuntimeError , "Invalid state: %d" , cs );
322302 goto _failed ;
323303 }
324304 }
@@ -355,6 +335,7 @@ static inline int unpack_execute(bool construct, unpack_context* ctx, const char
355335 goto _header_again ;
356336
357337 default :
338+ PyErr_Format (PyExc_RuntimeError , "Invalid container type: %u" , c -> ct );
358339 goto _failed ;
359340 }
360341
0 commit comments