]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Filter: Moved f_inst allocation to separate function
authorMaria Matejka <mq@ucw.cz>
Mon, 1 Jul 2019 10:49:02 +0000 (12:49 +0200)
committerMaria Matejka <mq@ucw.cz>
Mon, 1 Jul 2019 10:49:02 +0000 (12:49 +0200)
filter/decl.m4

index 77af84b3dfc166eaa4d11dd3eac195d920c99948..898b298d473b4219cb25b8489573c1e98b30527e 100644 (file)
@@ -87,10 +87,7 @@ struct f_inst *f_new_inst_]]INST_NAME()[[(enum f_instruction_code fi_code
 [[m4_undivert(102)]]
 )
   {
 [[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
   #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);
 }
 
     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)
 
 /* Instruction constructors */
 FID_WR_PUT(3)