Skip to content

Commit de6afa5

Browse files
author
Naoki INADA
committed
Reduce memory footprint.
1 parent d32b48f commit de6afa5

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

msgpack/unpack.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
2323
#define MSGPACK_MAX_STACK_SIZE (1024)
2424
#include "unpack_define.h"
2525

26-
using namespace std;
27-
28-
typedef map<string, PyObject*> str_cach_t;
26+
typedef std::map<std::string, PyObject*> str_cach_t;
2927
struct unpack_user {
3028
str_cach_t strcache;
3129

@@ -127,7 +125,7 @@ static inline int template_callback_map_item(unpack_user* u, msgpack_unpack_obje
127125
static inline int template_callback_raw(unpack_user* u, const char* b, const char* p, unsigned int l, msgpack_unpack_object* o)
128126
{
129127
if (l < 16) {
130-
string s(p, l);
128+
std::string s(p, l);
131129
str_cach_t ::iterator it = u->strcache.find(s);
132130
if (it != u->strcache.end()) {
133131
*o = it->second;

msgpack/unpack_template.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,13 @@
4343

4444
msgpack_unpack_struct_decl(_stack) {
4545
msgpack_unpack_object obj;
46-
size_t curr;
4746
size_t count;
4847
unsigned int ct;
49-
msgpack_unpack_object map_key;
48+
49+
union {
50+
size_t curr;
51+
msgpack_unpack_object map_key;
52+
};
5053
};
5154

5255
msgpack_unpack_struct_decl(_context) {

0 commit comments

Comments
 (0)