summaryrefslogtreecommitdiff
path: root/python/msgpack
diff options
context:
space:
mode:
authorNaoki INADA <inada-n@eagle>2009-06-24 01:54:47 +0900
committerNaoki INADA <inada-n@eagle>2009-06-24 01:54:47 +0900
commitf61b282886bb9d7f7932fbcbe2affee06d150a5f (patch)
tree113ea50b273f44c3e4de01bbc3eee9081e6ec81c /python/msgpack
parent3fd28d07928c51cb563f35d9dddb0c7867ac9875 (diff)
downloadmsgpack-python-f61b282886bb9d7f7932fbcbe2affee06d150a5f.tar.gz
Reduce memory footprint.
Diffstat (limited to 'python/msgpack')
-rw-r--r--python/msgpack/unpack.h6
-rw-r--r--python/msgpack/unpack_template.h7
2 files changed, 7 insertions, 6 deletions
diff --git a/python/msgpack/unpack.h b/python/msgpack/unpack.h
index cc48d9c..12afb99 100644
--- a/python/msgpack/unpack.h
+++ b/python/msgpack/unpack.h
@@ -23,9 +23,7 @@
#define MSGPACK_MAX_STACK_SIZE (1024)
#include "unpack_define.h"
-using namespace std;
-
-typedef map<string, PyObject*> str_cach_t;
+typedef std::map<std::string, PyObject*> str_cach_t;
struct unpack_user {
str_cach_t strcache;
@@ -127,7 +125,7 @@ static inline int template_callback_map_item(unpack_user* u, msgpack_unpack_obje
static inline int template_callback_raw(unpack_user* u, const char* b, const char* p, unsigned int l, msgpack_unpack_object* o)
{
if (l < 16) {
- string s(p, l);
+ std::string s(p, l);
str_cach_t ::iterator it = u->strcache.find(s);
if (it != u->strcache.end()) {
*o = it->second;
diff --git a/python/msgpack/unpack_template.h b/python/msgpack/unpack_template.h
index db33368..c960c3a 100644
--- a/python/msgpack/unpack_template.h
+++ b/python/msgpack/unpack_template.h
@@ -43,10 +43,13 @@
msgpack_unpack_struct_decl(_stack) {
msgpack_unpack_object obj;
- size_t curr;
size_t count;
unsigned int ct;
- msgpack_unpack_object map_key;
+
+ union {
+ size_t curr;
+ msgpack_unpack_object map_key;
+ };
};
msgpack_unpack_struct_decl(_context) {