From: Maria Matejka Date: Mon, 1 Jul 2019 10:49:02 +0000 (+0200) Subject: Filter: Moved f_inst allocation to separate function X-Git-Tag: v2.0.5~10^2~17 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fbird.git;a=commitdiff_plain;h=4212c0e7e5647e107e6e06238a417afc44fd7f75 Filter: Moved f_inst allocation to separate function --- diff --git a/filter/decl.m4 b/filter/decl.m4 index 77af84b3d..898b298d4 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)