int service_start(const char *method, const char *host, const char *uri, const struct module **module, struct data **app_data) { const struct service *serv; const struct module *mod; const char *module_arg; serv = service_find(host, uri); if (!serv) { Error("%s:could not find URI path\n", uri); return -1; } mod = service_module(serv); if (!mod) { Error("%s:no module defined\n", uri); return -1; } module_arg = service_arg(serv); *app_data = module_start(mod, method, uri, module_arg); *module = mod; // TODO: check for error?? Info("%s:using module %s\n", uri, mod->desc); return 0; }
/** * Resets an existing XML reader. * If you need to parse several XML files, this function is much faster than * xml_ReaderCreate() and xml_ReaderDelete() combined. * If the stream parameter is NULL, the XML reader will be stopped, but * not restarted until the next xml_ReaderReset() call with a non-NULL stream. * * @param reader XML reader to reinitialize * @param stream new stream to read XML data from (or NULL) * @return reader on success, * NULL on error (in that case, the reader is destroyed). */ xml_reader_t *xml_ReaderReset(xml_reader_t *reader, stream_t *stream) { if (reader->p_stream) module_stop(reader, reader->p_module); reader->p_stream = stream; if ((stream != NULL) && module_start(reader, reader->p_module)) { module_release(reader->p_module); vlc_object_release(reader); return NULL; } return reader; }
int module_start_all (modhash_t *mh) { zlist_t *uuids; char *uuid; int rc = -1; if (!(uuids = zhash_keys (mh->zh_byuuid))) oom (); uuid = zlist_first (uuids); while (uuid) { module_t *p = zhash_lookup (mh->zh_byuuid, uuid); assert (p != NULL); if (module_start (p) < 0) goto done; uuid = zlist_next (uuids); } rc = 0; done: zlist_destroy (&uuids); return rc; }