From f02d77f4b45d0a5a0ce86a87f056c91de1e4b731 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 27 Jul 2010 13:38:51 +0200 Subject: final (?) milestone: looks like action scoping works now but doc and testing is missing! --- runtime/conf.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'runtime/conf.c') diff --git a/runtime/conf.c b/runtime/conf.c index c4c72ec2..1d80c867 100644 --- a/runtime/conf.c +++ b/runtime/conf.c @@ -1263,11 +1263,44 @@ static inline rsRetVal setActionScope(void) { DEFiRet; + modInfo_t *pMod; currConfObj = eConfObjAction; DBGPRINTF("entering action scope\n"); CHKiRet(actionNewScope()); + /* now tell each action to start the scope */ + pMod = NULL; + while((pMod = module.GetNxtType(pMod, eMOD_OUT)) != NULL) { + DBGPRINTF("beginning scope on module %s\n", pMod->pszName); + pMod->mod.om.newScope(); + } + +finalize_it: + RETiRet; +} + + +/* switch back from action scope. + * rgerhards, 2010-07-27 + */ +static inline rsRetVal +unsetActionScope(void) +{ + DEFiRet; + modInfo_t *pMod; + + currConfObj = eConfObjAction; + DBGPRINTF("exiting action scope\n"); + CHKiRet(actionRestoreScope()); + + /* now tell each action to restore the scope */ + pMod = NULL; + while((pMod = module.GetNxtType(pMod, eMOD_OUT)) != NULL) { + DBGPRINTF("exiting scope on module %s\n", pMod->pszName); + pMod->mod.om.restoreScope(); + } + finalize_it: RETiRet; } @@ -1324,7 +1357,7 @@ endConfObj(void __attribute__((unused)) *pVal, uchar *pszName) ABORT_FINALIZE(RS_RET_CONF_INVLD_END); } currConfObj = eConfObjGlobal; - CHKiRet(actionRestoreScope()); + CHKiRet(unsetActionScope()); } else { errmsg.LogError(0, RS_RET_INVLD_CONF_OBJ, "invalid config object \"%s\" in $End", pszName); ABORT_FINALIZE(RS_RET_INVLD_CONF_OBJ); -- cgit