summaryrefslogtreecommitdiffstats
path: root/runtime/vmprg.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-08-21 10:19:56 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-08-21 10:19:56 +0200
commitbd7542b51593739893922e8ec8fb6d7195d06cbe (patch)
treef7d0a85f593c2b71876365788535bd1b83c73dae /runtime/vmprg.c
parent51aa94ea2c2ae57a6c7207aecf39dd4b578ad8f0 (diff)
parent675d46f5b59f64e378968baa5e0dec6810090287 (diff)
downloadrsyslog-ac32b9c30855fe601dab50cffe1a929e79f02013.tar.gz
rsyslog-ac32b9c30855fe601dab50cffe1a929e79f02013.tar.xz
rsyslog-ac32b9c30855fe601dab50cffe1a929e79f02013.zip
Merge branch 'v4.3.2' (v4-beta) into v4-stablev4.4.0
Conflicts: ChangeLog configure.ac doc/manual.html tests/Makefile.am
Diffstat (limited to 'runtime/vmprg.c')
-rw-r--r--runtime/vmprg.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/runtime/vmprg.c b/runtime/vmprg.c
index 75915025..07757b98 100644
--- a/runtime/vmprg.c
+++ b/runtime/vmprg.c
@@ -155,7 +155,6 @@ vmprgAddVarOperation(vmprg_t *pThis, opcode_t opcode, var_t *pVar)
/* construct and fill vmop */
CHKiRet(vmop.Construct(&pOp));
CHKiRet(vmop.ConstructFinalize(pOp));
- CHKiRet(vmop.ConstructFinalize(pOp));
CHKiRet(vmop.SetOpcode(pOp, opcode));
if(pVar != NULL)
CHKiRet(vmop.SetVar(pOp, pVar));
@@ -168,6 +167,32 @@ finalize_it:
}
+/* this is another shortcut for high-level callers. It is similar to vmprgAddVarOperation
+ * but adds a call operation. Among others, this include a check if the function
+ * is known.
+ */
+static rsRetVal
+vmprgAddCallOperation(vmprg_t *pThis, cstr_t *pcsName)
+{
+ DEFiRet;
+ vmop_t *pOp;
+
+ ISOBJ_TYPE_assert(pThis, vmprg);
+
+ /* construct and fill vmop */
+ CHKiRet(vmop.Construct(&pOp));
+ CHKiRet(vmop.ConstructFinalize(pOp));
+ CHKiRet(vmop.SetFunc(pOp, pcsName));
+ CHKiRet(vmop.SetOpcode(pOp, opcode_FUNC_CALL));
+
+ /* and add it to the program */
+ CHKiRet(vmprgAddOperation(pThis, pOp));
+
+finalize_it:
+ RETiRet;
+}
+
+
/* queryInterface function
* rgerhards, 2008-02-21
*/
@@ -189,6 +214,7 @@ CODESTARTobjQueryInterface(vmprg)
pIf->Obj2Str = Obj2Str;
pIf->AddOperation = vmprgAddOperation;
pIf->AddVarOperation = vmprgAddVarOperation;
+ pIf->AddCallOperation = vmprgAddCallOperation;
finalize_it:
ENDobjQueryInterface(vmprg)