py: Provide typedefs for function types instead of writing them inline.
This commit is contained in:
parent
4dea922610
commit
91bc32dc16
|
@ -400,7 +400,9 @@ STATIC scope_t *scope_new_and_link(compiler_t *comp, scope_kind_t kind, mp_parse
|
||||||
return scope;
|
return scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC void apply_to_single_or_list(compiler_t *comp, mp_parse_node_t pn, pn_kind_t pn_list_kind, void (*f)(compiler_t*, mp_parse_node_t)) {
|
typedef void (*apply_list_fun_t)(compiler_t *comp, mp_parse_node_t pn);
|
||||||
|
|
||||||
|
STATIC void apply_to_single_or_list(compiler_t *comp, mp_parse_node_t pn, pn_kind_t pn_list_kind, apply_list_fun_t f) {
|
||||||
if (MP_PARSE_NODE_IS_STRUCT_KIND(pn, pn_list_kind)) {
|
if (MP_PARSE_NODE_IS_STRUCT_KIND(pn, pn_list_kind)) {
|
||||||
mp_parse_node_struct_t *pns = (mp_parse_node_struct_t*)pn;
|
mp_parse_node_struct_t *pns = (mp_parse_node_struct_t*)pn;
|
||||||
int num_nodes = MP_PARSE_NODE_STRUCT_NUM_NODES(pns);
|
int num_nodes = MP_PARSE_NODE_STRUCT_NUM_NODES(pns);
|
||||||
|
|
|
@ -77,7 +77,9 @@ void emit_bc_free(emit_t *emit) {
|
||||||
m_del_obj(emit_t, emit);
|
m_del_obj(emit_t, emit);
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC void emit_write_uint(emit_t *emit, byte*(*allocator)(emit_t*, int), mp_uint_t val) {
|
typedef byte *(*emit_allocator_t)(emit_t *emit, int nbytes);
|
||||||
|
|
||||||
|
STATIC void emit_write_uint(emit_t *emit, emit_allocator_t allocator, mp_uint_t val) {
|
||||||
// We store each 7 bits in a separate byte, and that's how many bytes needed
|
// We store each 7 bits in a separate byte, and that's how many bytes needed
|
||||||
byte buf[BYTES_FOR_INT];
|
byte buf[BYTES_FOR_INT];
|
||||||
byte *p = buf + sizeof(buf);
|
byte *p = buf + sizeof(buf);
|
||||||
|
|
Loading…
Reference in New Issue