diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2012-08-27 17:09:54 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2012-08-27 17:09:54 +0200 |
commit | a74898dc827ed4a8f9587196716746031b1e5169 (patch) | |
tree | fe6cc689c047b6fda7cad92dd8ff9a170af92873 /grammar/rainerscript.c | |
parent | d1589cd43978c700e2c88747e04d29c64a25d185 (diff) | |
parent | 3d56820f130e6c1b674560125e677be3b6a2d8f4 (diff) | |
download | rsyslog-a74898dc827ed4a8f9587196716746031b1e5169.tar.gz rsyslog-a74898dc827ed4a8f9587196716746031b1e5169.tar.bz2 rsyslog-a74898dc827ed4a8f9587196716746031b1e5169.zip |
Merge branch 'master-newtemplate'
Conflicts:
runtime/msg.c
Diffstat (limited to 'grammar/rainerscript.c')
-rw-r--r-- | grammar/rainerscript.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/grammar/rainerscript.c b/grammar/rainerscript.c index 3bfb2e07..33630a76 100644 --- a/grammar/rainerscript.c +++ b/grammar/rainerscript.c @@ -98,6 +98,62 @@ readConfFile(FILE *fp, es_str_t **str) es_addChar(str, '\0'); } +struct objlst* +objlstNew(struct cnfobj *o) +{ + struct objlst *lst; + + if((lst = malloc(sizeof(struct objlst))) != NULL) { + lst->next = NULL; + lst->obj = o; + } +dbgprintf("AAAA: creating new objlst\n"); +cnfobjPrint(o); + + return lst; +} + +/* add object to end of object list, always returns pointer to root object */ +struct objlst* +objlstAdd(struct objlst *root, struct cnfobj *o) +{ + struct objlst *l; + struct objlst *newl; + + newl = objlstNew(o); + if(root == 0) { + root = newl; + } else { /* find last, linear search ok, as only during config phase */ + for(l = root ; l->next != NULL ; l = l->next) + ; + l->next = newl; + } + return root; +} + +void +objlstDestruct(struct objlst *lst) +{ + struct objlst *toDel; + + while(lst != NULL) { + toDel = lst; + lst = lst->next; + // TODO: delete object + free(toDel); + } +} + +void +objlstPrint(struct objlst *lst) +{ + dbgprintf("objlst %p:\n", lst); + while(lst != NULL) { + cnfobjPrint(lst->obj); + lst = lst->next; + } +} + struct nvlst* nvlstNew(es_str_t *name, es_str_t *value) { @@ -581,6 +637,7 @@ cnfobjNew(enum cnfobjType objType, struct nvlst *lst) nvlstChkDupes(lst); o->objType = objType; o->nvlst = lst; + o->subobjs = NULL; } return o; |