static void createAndOpen(const char *name, dbChannel**pch) { testOk(!!(*pch = dbChannelCreate(name)), "dbChannel %s created", name); testOk(!(dbChannelOpen(*pch)), "dbChannel opened"); testOk((ellCount(&(*pch)->pre_chain) == 0), "no filters in pre chain"); testOk((ellCount(&(*pch)->post_chain) == 0), "no filters in post chain"); }
struct dbChannel * dbChannel_create(const char *pname) { dbChannel *chan = dbChannelCreate(pname); if (!chan) return NULL; if (INVALID_DB_REQ(dbChannelExportType(chan)) || dbChannelOpen(chan)) { dbChannelDelete(chan); return NULL; } return chan; }
static void createAndOpen(const char *chan, const char *json, const char *type, dbChannel**pch, short no) { ELLNODE *node; char name[80]; strncpy(name, chan, sizeof(name)-1); strncat(name, json, sizeof(name)-strlen(name)-1); testOk(!!(*pch = dbChannelCreate(name)), "dbChannel with plugin arr %s created", type); testOk((ellCount(&(*pch)->filters) == no), "channel has %d filter(s) in filter list", no); testOk(!(dbChannelOpen(*pch)), "dbChannel with plugin arr opened"); node = ellFirst(&(*pch)->pre_chain); (void) CONTAINER(node, chFilter, pre_node); testOk((ellCount(&(*pch)->pre_chain) == 0), "arr has no filter in pre chain"); node = ellFirst(&(*pch)->post_chain); (void) CONTAINER(node, chFilter, post_node); testOk((ellCount(&(*pch)->post_chain) == no), "arr has %d filter(s) in post chain", no); }