summaryrefslogtreecommitdiffstats
path: root/runtime/modules.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-04-27 17:11:41 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2011-04-27 17:11:41 +0200
commit5cd3cdf3c82ef49506124ace13d20c52afd5d44a (patch)
tree5d510436b780c30757378bbc70b8f8024db38f4b /runtime/modules.c
parent4f8457ffe3bc0a104a86ac79622844c4206adbbb (diff)
downloadrsyslog-5cd3cdf3c82ef49506124ace13d20c52afd5d44a.tar.gz
rsyslog-5cd3cdf3c82ef49506124ace13d20c52afd5d44a.tar.xz
rsyslog-5cd3cdf3c82ef49506124ace13d20c52afd5d44a.zip
step: config-specific module list used during config processing
Diffstat (limited to 'runtime/modules.c')
-rw-r--r--runtime/modules.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/runtime/modules.c b/runtime/modules.c
index 8cdc9bb1..69c89790 100644
--- a/runtime/modules.c
+++ b/runtime/modules.c
@@ -335,7 +335,7 @@ addModToGlblList(modInfo_t *pThis)
/* Add a module to the config module list for current loadConf
*/
-static inline rsRetVal
+rsRetVal
addModToCnfList(modInfo_t *pThis)
{
cfgmodules_etry_t *pNew;
@@ -401,18 +401,31 @@ static modInfo_t *GetNxt(modInfo_t *pThis)
/* this function is like GetNxt(), but it returns pointers to
- * modules of specific type only.
- * rgerhards, 2007-07-24
+ * modules of specific type only. Only modules from the provided
+ * config are returned. Note that processing speed could be improved,
+ * but this is really not relevant, as config file loading is not really
+ * something we are concerned about in regard to runtime.
*/
-static modInfo_t *GetNxtType(modInfo_t *pThis, eModType_t rqtdType)
+static modInfo_t *GetNxtCnfType(rsconf_t *cnf, modInfo_t *pThis, eModType_t rqtdType)
{
- modInfo_t *pMod = pThis;
+ cfgmodules_etry_t *node;
+
+ if(pThis == NULL) { /* start at beginning of module list */
+ node = cnf->modules.root;
+ } else { /* start at last location - then we need to find the module in the config list */
+ for(node = cnf->modules.root ; node != NULL && node->pMod != pThis ; node = node->next)
+ /*search only, all done in for() */;
+ if(node != NULL)
+ node = node->next; /* skip to NEXT element in list */
+ }
- do {
- pMod = GetNxt(pMod);
- } while(!(pMod == NULL || pMod->eType == rqtdType)); /* warning: do ... while() */
+dbgprintf("XXXX: entering node, ptr %p: %s\n", node, (node == NULL)? "":modGetName(node->pMod));
+ while(node != NULL && node->pMod->eType != rqtdType) {
+ node = node->next; /* warning: do ... while() */
+dbgprintf("XXXX: in loop, ptr %p: %s\n", node, (node == NULL)? "":modGetName(node->pMod));
+ }
- return pMod;
+ return (node == NULL) ? NULL : node->pMod;
}
@@ -1111,7 +1124,7 @@ CODESTARTobjQueryInterface(module)
* of course, also affects the "if" above).
*/
pIf->GetNxt = GetNxt;
- pIf->GetNxtType = GetNxtType;
+ pIf->GetNxtCnfType = GetNxtCnfType;
pIf->GetName = modGetName;
pIf->GetStateName = modGetStateName;
pIf->PrintList = modPrintList;