summaryrefslogtreecommitdiffstats
path: root/vmstk.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-02-25 09:20:09 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-02-25 09:20:09 +0000
commit838ab14a17a60116d6fd51ebcf12416d736af546 (patch)
treeedb5a34b9597d290aeb73714e02781f174499808 /vmstk.c
parentc72b5030fbb996505e3874e0f6cda63dea29730e (diff)
downloadrsyslog-838ab14a17a60116d6fd51ebcf12416d736af546.tar.gz
rsyslog-838ab14a17a60116d6fd51ebcf12416d736af546.tar.xz
rsyslog-838ab14a17a60116d6fd51ebcf12416d736af546.zip
implemented majority of comparison operations
Diffstat (limited to 'vmstk.c')
-rw-r--r--vmstk.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/vmstk.c b/vmstk.c
index 0e035543..6f8d36f6 100644
--- a/vmstk.c
+++ b/vmstk.c
@@ -160,6 +160,31 @@ finalize_it:
}
+/* pop two variables for a common operation, e.g. a compare. When this
+ * functions returns, both variables have the same type, but the type
+ * is not set to anything specific.
+ * The user is responsible for destructing the ppVar's returned.
+ * A quick note on the name: it means pop 2 variable for a common
+ * opertion - just in case you wonder (I don't really like the name,
+ * but I didn't come up with a better one...).
+ * rgerhards, 2008-02-25
+ */
+static rsRetVal
+pop2CommOp(vmstk_t *pThis, var_t **ppVar1, var_t **ppVar2)
+{
+ DEFiRet;
+
+ /* assertions are done in pop(), we do not duplicate here */
+ /* operand two must be popped first, because it is at the top of stack */
+ CHKiRet(pop(pThis, ppVar2));
+ CHKiRet(pop(pThis, ppVar1));
+ CHKiRet(var.ConvForOperation(*ppVar1, *ppVar2));
+
+finalize_it:
+ RETiRet;
+}
+
+
/* queryInterface function
* rgerhards, 2008-02-21
*/
@@ -185,6 +210,7 @@ CODESTARTobjQueryInterface(vmstk)
pIf->PopBool = popBool;
pIf->PopNumber = popNumber;
pIf->PopString = popString;
+ pIf->Pop2CommOp = pop2CommOp;
finalize_it:
ENDobjQueryInterface(vmstk)