diff options
author | Damien George <damien.p.george@gmail.com> | 2014-05-10 17:36:41 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-05-10 17:36:41 +0100 |
commit | 1b82e9af5c9b67cae8f7a35abc2dee3989fbdc06 (patch) | |
tree | 8f1dd9ece17d60d40d8bd6157fd2a2a01abd082f /py/misc.h | |
parent | ad6178bb08de66783b4551ebcd444bf06647326a (diff) |
py: Improve handling of memory error in parser.
Parser shouldn't raise exceptions, so needs to check when memory
allocation fails. This patch does that for the initial set up of the
parser state.
Also, we now put the parser object on the stack. It's small enough to
go there instead of on the heap.
This partially addresses issue #558.
Diffstat (limited to 'py/misc.h')
-rw-r--r-- | py/misc.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -50,6 +50,7 @@ typedef unsigned int uint; // TODO make a lazy m_renew that can increase by a smaller amount than requested (but by at least 1 more element) #define m_new(type, num) ((type*)(m_malloc(sizeof(type) * (num)))) +#define m_new_maybe(type, num) ((type*)(m_malloc_maybe(sizeof(type) * (num)))) #define m_new0(type, num) ((type*)(m_malloc0(sizeof(type) * (num)))) #define m_new_obj(type) (m_new(type, 1)) #define m_new_obj_var(obj_type, var_type, var_num) ((obj_type*)m_malloc(sizeof(obj_type) + sizeof(var_type) * (var_num))) |