diff options
Diffstat (limited to 'runtime/ruleset.c')
-rw-r--r-- | runtime/ruleset.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/runtime/ruleset.c b/runtime/ruleset.c index 392473e9..a40e2ed1 100644 --- a/runtime/ruleset.c +++ b/runtime/ruleset.c @@ -219,7 +219,6 @@ dbgprintf("RRRR: execAct: batch of %d elements, active %p\n", batchNumMsgs(pBatc RETiRet; } -/* for details, see scriptExec() header comment! */ static rsRetVal execSet(struct cnfstmt *stmt, batch_t *pBatch, sbool *active) { @@ -230,8 +229,23 @@ execSet(struct cnfstmt *stmt, batch_t *pBatch, sbool *active) if( pBatch->pElem[i].state != BATCH_STATE_DISC && (active == NULL || active[i])) { cnfexprEval(stmt->d.s_set.expr, &result, pBatch->pElem[i].pUsrp); - msgSetJSONFromVar(pBatch->pElem[i].pUsrp, stmt->d.s_set.varname, + msgSetJSONFromVar((msg_t*)pBatch->pElem[i].pUsrp, stmt->d.s_set.varname, &result); + varDelete(&result); + } + } + RETiRet; +} + +static rsRetVal +execUnset(struct cnfstmt *stmt, batch_t *pBatch, sbool *active) +{ + int i; + DEFiRet; + for(i = 0 ; i < batchNumMsgs(pBatch) && !*(pBatch->pbShutdownImmediate) ; ++i) { + if( pBatch->pElem[i].state != BATCH_STATE_DISC + && (active == NULL || active[i])) { + msgUnsetJSON((msg_t*)pBatch->pElem[i].pUsrp, stmt->d.s_unset.varname); } } RETiRet; @@ -321,7 +335,6 @@ execPRIFILT(struct cnfstmt *stmt, batch_t *pBatch, sbool *active) DBGPRINTF("batch: item %d PRIFILT %d\n", i, thenAct[i]); } -dbgprintf("RRRR: PRIFILT calling %p\n", stmt->d.s_prifilt.t_then); scriptExec(stmt->d.s_prifilt.t_then, pBatch, thenAct); freeActive(thenAct); } @@ -436,7 +449,6 @@ execPROPFILT(struct cnfstmt *stmt, batch_t *pBatch, sbool *active) DBGPRINTF("batch: item %d PROPFILT %d\n", i, thenAct[i]); } -dbgprintf("RRRR: PROPFILT calling %p\n", stmt->d.s_propfilt.t_then); scriptExec(stmt->d.s_propfilt.t_then, pBatch, thenAct); freeActive(thenAct); } @@ -468,12 +480,15 @@ dbgprintf("RRRR: scriptExec: batch of %d elements, active %p, stmt %p, nodetype case S_ACT: execAct(stmt, pBatch, active); break; - case S_IF: - execIf(stmt, pBatch, active); - break; case S_SET: execSet(stmt, pBatch, active); break; + case S_UNSET: + execUnset(stmt, pBatch, active); + break; + case S_IF: + execIf(stmt, pBatch, active); + break; case S_PRIFILT: execPRIFILT(stmt, pBatch, active); break; |