aboutsummaryrefslogtreecommitdiffstats
path: root/parser/rpp/pp-symbol.h
diff options
context:
space:
mode:
authorModestas Vainius <modestas@vainius.eu>2010-09-02 10:51:13 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-09 19:10:09 -0300
commit396b71f4ddcbcdd7772bb9c02be8df642b7a1be2 (patch)
tree644a225998369b11f85288c2ea30d8a3028079ee /parser/rpp/pp-symbol.h
parent2d170a0b8b1519befc4cdad57a0a46ccf8d16e0a (diff)
Fixes various memory alignment issues which cause generator to crash on alignment-sensitive architectures.
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Renato Araújo <renato.filho@openbossa.org>
Diffstat (limited to 'parser/rpp/pp-symbol.h')
-rw-r--r--parser/rpp/pp-symbol.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/parser/rpp/pp-symbol.h b/parser/rpp/pp-symbol.h
index eef668379..8078aba8c 100644
--- a/parser/rpp/pp-symbol.h
+++ b/parser/rpp/pp-symbol.h
@@ -39,6 +39,11 @@ class pp_symbol
static rxx_allocator<char>__allocator;
return __allocator;
}
+ static rxx_allocator<pp_fast_string> &ppfs_allocator_instance ()
+ {
+ static rxx_allocator<pp_fast_string>__ppfs_allocator;
+ return __ppfs_allocator;
+ }
public:
static int &N() {
@@ -52,7 +57,7 @@ public:
memcpy(data, __data, __size);
data[__size] = '\0';
- char *where = allocator_instance().allocate(sizeof(pp_fast_string));
+ pp_fast_string *where = ppfs_allocator_instance ().allocate (sizeof (pp_fast_string));
return new(where) pp_fast_string(data, __size);
}
@@ -71,7 +76,7 @@ public:
std::copy(__first, __last, data);
data[__size] = '\0';
- char *where = allocator_instance().allocate(sizeof(pp_fast_string));
+ pp_fast_string *where = ppfs_allocator_instance ().allocate (sizeof (pp_fast_string));
return new(where) pp_fast_string(data, __size);
}