diff options
author | Maria Matejka <mq@ucw.cz> | 2019-07-01 12:49:02 +0200 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2019-07-01 12:49:02 +0200 |
commit | 4212c0e7e5647e107e6e06238a417afc44fd7f75 (patch) | |
tree | 81a2f9c49093413b55def0373a2b6cfaed92390f /filter | |
parent | f74d19765ea3fafdff8fd3443f50a7b309babe89 (diff) |
Filter: Moved f_inst allocation to separate function
Diffstat (limited to 'filter')
-rw-r--r-- | filter/decl.m4 | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/filter/decl.m4 b/filter/decl.m4 index 77af84b3..898b298d 100644 --- a/filter/decl.m4 +++ b/filter/decl.m4 @@ -87,10 +87,7 @@ struct f_inst *f_new_inst_]]INST_NAME()[[(enum f_instruction_code fi_code [[m4_undivert(102)]] ) { - struct f_inst *what = cfg_allocz(sizeof(struct f_inst)); - what->fi_code = fi_code; - what->lineno = ifs->lino; - what->size = 1; + struct f_inst *what = fi_new(fi_code); #define whati (&(what->i_]]INST_NAME()[[)) [[m4_undivert(103)]] #undef whati @@ -272,6 +269,16 @@ f_instruction_name(enum f_instruction_code fi) bug("Got unknown instruction code: %d", fi); } +static inline struct f_inst * +fi_new(enum f_instruction_code fi_code) +{ + struct f_inst *what = cfg_allocz(sizeof(struct f_inst)); + what->lineno = ifs->lino; + what->size = 1; + what->fi_code = fi_code; + return what; +} + /* Instruction constructors */ FID_WR_PUT(3) |