Replaced glib memory allocation
This commit is contained in:
parent
6101b8c43a
commit
d5729efa1f
33 changed files with 414 additions and 166 deletions
|
|
@ -33,6 +33,9 @@ static const HParserVtable int_range_vt = {
|
|||
};
|
||||
|
||||
const HParser* h_int_range(const HParser *p, const int64_t lower, const int64_t upper) {
|
||||
return h_int_range__m(&system_allocator, p, lower, upper);
|
||||
}
|
||||
const HParser* h_int_range__m(HAllocator* mm__, const HParser *p, const int64_t lower, const int64_t upper) {
|
||||
// p must be an integer parser, which means it's using parse_bits
|
||||
// TODO: re-add this check
|
||||
//assert_message(p->vtable == &bits_vt, "int_range requires an integer parser");
|
||||
|
|
@ -40,11 +43,11 @@ const HParser* h_int_range(const HParser *p, const int64_t lower, const int64_t
|
|||
// and regardless, the bounds need to fit in the parser in question
|
||||
// TODO: check this as well.
|
||||
|
||||
HRange *r_env = g_new(HRange, 1);
|
||||
HRange *r_env = h_new(HRange, 1);
|
||||
r_env->p = p;
|
||||
r_env->lower = lower;
|
||||
r_env->upper = upper;
|
||||
HParser *ret = g_new(HParser, 1);
|
||||
HParser *ret = h_new(HParser, 1);
|
||||
ret->vtable = &int_range_vt;
|
||||
ret->env = (void*)r_env;
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue