… | |
… | |
10 | |
10 | |
11 | #include <tr1/unordered_set> |
11 | #include <tr1/unordered_set> |
12 | |
12 | |
13 | #include "global.h" |
13 | #include "global.h" |
14 | |
14 | |
15 | typedef std::tr1::unordered_set<const char *, str_hash, str_equal> HT; |
15 | typedef std::tr1::unordered_set <const char *, str_hash, str_equal, slice_allocator<const char *>, true> HT; |
16 | |
16 | |
17 | static HT ht; |
17 | static HT ht; |
18 | |
18 | |
19 | static const char * |
19 | static const char * |
20 | makevec (const char *s) |
20 | makevec (const char *s) |
21 | { |
21 | { |
22 | int len = strlen (s); |
22 | int len = strlen (s); |
23 | |
23 | |
24 | const char *v = (const char *) (2 + (int *) g_slice_alloc (sizeof (int) * 2 + len + 1)); |
24 | const char *v = (const char *) (2 + (int *)g_slice_alloc (sizeof (int) * 2 + len + 1)); |
25 | |
25 | |
26 | shstr::length (v) = len; |
26 | shstr::length (v) = len; |
27 | shstr::refcnt (v) = 1; |
27 | shstr::refcnt (v) = 1; |
28 | |
28 | |
29 | memcpy ((char *) v, s, len + 1); |
29 | memcpy ((char *) v, s, len + 1); |