xmlNode *php_dom_libxml_notation_iter(xmlHashTable *ht, int index) /* {{{ */ { notationIterator *iter; xmlNotation *notep = NULL; int htsize; if ((htsize = xmlHashSize(ht)) > 0 && index < htsize) { iter = emalloc(sizeof(notationIterator)); iter->cur = 0; iter->index = index; iter->notation = NULL; xmlHashScan(ht, itemHashScanner, iter); notep = iter->notation; efree(iter); return create_notation(notep->name, notep->PublicID, notep->SystemID); } else { return NULL; } }
xmlNode *php_dom_libxml_hash_iter(xmlHashTable *ht, int index) /* {{{ */ { xmlNode *nodep = NULL; nodeIterator *iter; int htsize; if ((htsize = xmlHashSize(ht)) > 0 && index < htsize) { iter = emalloc(sizeof(nodeIterator)); iter->cur = 0; iter->index = index; iter->node = NULL; xmlHashScan(ht, itemHashScanner, iter); nodep = iter->node; efree(iter); return nodep; } else { return NULL; } }
void do_housekeeping(struct handler_args* h, xmlHashTablePtr sessions, struct qz_config* conf){ double start = gettime(); struct session_housekeeping_data data = (struct session_housekeeping_data){ .session_inactivity_timeout = conf->session_inactivity_timeout, .sessions = sessions, .hargs = h, }; fprintf(h->log, "%f %d %s:%d starting housekeeping\n", gettime(), h->request_id, __func__, __LINE__); xmlHashScan(sessions, session_housekeeping_scanner, &data); fprintf(h->log, "%f %d %s:%d housekeeping complete duration %f\n", gettime(), h->request_id, __func__, __LINE__, gettime() - start); } #ifdef SESSION_MAIN #define NBRTESTS 5 pid_t tagger_pid = 0; void cleanup(sig){ // kill tagger fprintf(stderr, "cleanup kill pid %d\n", tagger_pid); kill(tagger_pid, SIGTERM); int status; waitpid(tagger_pid, &status, 0); fprintf(stderr, "waitpid status = %d\n", status); exit(0); }
static HRESULT WINAPI schema_cache_addCollection(IXMLDOMSchemaCollection2* iface, IXMLDOMSchemaCollection* collection) { schema_cache* This = impl_from_IXMLDOMSchemaCollection2(iface); schema_cache* That; TRACE("(%p)->(%p)\n", This, collection); if (!collection) return E_POINTER; That = unsafe_impl_from_IXMLDOMSchemaCollection(collection); if (!That) { ERR("external collection implementation\n"); return E_FAIL; } /* TODO: detect errors while copying & return E_FAIL */ xmlHashScan(That->cache, cache_copy, This); return S_OK; }
/** * xmlDumpEntitiesTable: * @buf: An XML buffer. * @table: An entity table * * This will dump the content of the entity table as an XML DTD definition */ void xmlDumpEntitiesTable(xmlBufferPtr buf, xmlEntitiesTablePtr table) { xmlHashScan(table, (xmlHashScanner)xmlDumpEntityDecl, buf); }
/** * This is the main function for 'el' option */ int elMain(int argc, char **argv) { int errorno = 0; char* inp_file = "-"; if (argc <= 1) elUsage(argc, argv, EXIT_BAD_ARGS); elInitOptions(&elOps); if (argc == 2) errorno = parse_xml_file("-"); else { if (!strcmp(argv[2], "--help") || !strcmp(argv[2], "-h") || !strcmp(argv[2], "-?") || !strcmp(argv[2], "-Z")) { elUsage(argc, argv, EXIT_SUCCESS); } else if (!strcmp(argv[2], "-a")) { elOps.show_attr = 1; if (argc >= 4) inp_file = argv[3]; errorno = parse_xml_file(inp_file); } else if (!strcmp(argv[2], "-v")) { elOps.show_attr_and_val = 1; if (argc >= 4) inp_file = argv[3]; errorno = parse_xml_file(inp_file); } else if (!strcmp(argv[2], "-u")) { elOps.sort_uniq = 1; if (argc >= 4) inp_file = argv[3]; uniq = xmlHashCreate(0); errorno = parse_xml_file(inp_file); } else if (!strncmp(argv[2], "-d", 2)) { elOps.check_depth = atoi(argv[2]+2); /* printf("Checking depth (%d)\n", elOps.check_depth); */ elOps.sort_uniq = 1; if (argc >= 4) inp_file = argv[3]; uniq = xmlHashCreate(0); errorno = parse_xml_file(inp_file); } else if (argv[2][0] != '-') { errorno = parse_xml_file(argv[2]); } else elUsage(argc, argv, EXIT_BAD_ARGS); } if (uniq) { int i; ArrayDest lines; lines.array = xmlMalloc(sizeof(xmlChar*) * xmlHashSize(uniq)); lines.offset = 0; xmlHashScan(uniq, hash_key_put, &lines); qsort(lines.array, lines.offset, sizeof(xmlChar*), compare_string_ptr); for (i = 0; i < lines.offset; i++) { printf("%s\n", lines.array[i]); } xmlFree(lines.array); xmlHashFree(uniq, NULL); } return errorno; }
/* put them back to list, and fill the domain */ dn = strdup((char*)domain); for(c=(Contact*)payload;c;c=c->d_next) { c->domain = dn; c->g_next = cl->list; cl->list = c; } }/*}}}*/ void _cl_sort_contacts(CL *cl)/*{{{*/ { cl->list = NULL; xmlHashScan(cl->table, _cl_contact_sorter, cl); cl->flag |= CL_SORTED; }/*}}}*/
/** * xslDbgShellPrintVariable: * @styleCtxt: The current stylesheet context * @arg: The name of variable to look for '$' prefix is optional and in UTF-8 * @type: A valid VariableTypeEnum * * Print the value variable specified by args. * * Returns 1 on success, * 0 otherwise */ int xslDbgShellPrintVariable(xsltTransformContextPtr styleCtxt, xmlChar * arg, VariableTypeEnum type) { int result = 0; /* command argument to include both name and its value */ static const char * FULLNAME_STR = "-f"; /* Quietly exit if an invalid stylesheet is provided */ static const char * QUIET_STR = "-q"; bool silenceCtxtErrors = false; if (!arg) { #ifdef WITH_XSLDBG_DEBUG_PROCESS xsltGenericError(xsltGenericErrorContext, "Error: NULL argument provided\n"); #endif return result; } varCount = 0; /* Do we quietly ingore style context errors */ if (strncasecmp((char*)arg, QUIET_STR, strlen(QUIET_STR))== 0){ silenceCtxtErrors = true; arg = arg + strlen(QUIET_STR); while (isspace(*arg)){ arg++; } } if (!styleCtxt) { if (!(!xsldbgReachedFirstTemplate && silenceCtxtErrors)) xsldbgGenericErrorFunc(i18n("Error: Debugger has no files loaded or libxslt has not reached a template.\nTry reloading files or taking more steps.\n")); return result; } /* Do we include the name as well as its value */ if (strncasecmp((char*)arg, FULLNAME_STR, strlen(FULLNAME_STR))== 0){ printVariableValue = 1; arg = arg + strlen(FULLNAME_STR); while (isspace(*arg)){ arg++; } } if (arg[0] == 0) { /* list variables of type requested */ if (type == DEBUG_GLOBAL_VAR) { if (styleCtxt->globalVars) { if (getThreadStatus() == XSLDBG_MSG_THREAD_RUN) { notifyListStart(XSLDBG_MSG_GLOBALVAR_CHANGED); /* list global variables */ xmlHashScan(styleCtxt->globalVars, (xmlHashScanner) xslDbgShellPrintNames, NULL); notifyListSend(); } else /* list global variables */ xmlHashScan(styleCtxt->globalVars, (xmlHashScanner) xslDbgShellPrintNames, NULL); result = 1; /* ensure that the locals follow imediately after the * globals when in gdb mode */ if (optionsGetIntOption(OPTIONS_GDB) == 0) xsltGenericError(xsltGenericErrorContext, "\n"); } else { if (getThreadStatus() != XSLDBG_MSG_THREAD_RUN) { /* Don't show this message when running as a thread as it * is annoying */ xsldbgGenericErrorFunc(i18n("Error: Libxslt has not initialized variables yet; try stepping to a template.\n")); } else { /* send an empty list */ notifyListStart(XSLDBG_MSG_GLOBALVAR_CHANGED); notifyListSend(); result = 1; } } } else { /* list local variables */ if (styleCtxt->varsNr && styleCtxt->varsTab) { if (getThreadStatus() == XSLDBG_MSG_THREAD_RUN) { notifyListStart(XSLDBG_MSG_LOCALVAR_CHANGED); for (int i = styleCtxt->varsNr; i > styleCtxt->varsBase; i--) { xsltStackElemPtr item = styleCtxt->varsTab[i-1]; while (item) { notifyListQueue(item); item = item->next; } } notifyListSend(); } else { xmlChar * fullQualifiedName = nodeViewBuffer; for (int i = styleCtxt->varsNr; i > styleCtxt->varsBase; i--) { xsltStackElemPtr item = styleCtxt->varsTab[i-1]; while (item) { if (item->name) { if (item->nameURI == NULL){ snprintf((char*)fullQualifiedName, sizeof(nodeViewBuffer), "$%s", item->name); }else{ snprintf((char*)fullQualifiedName, sizeof(nodeViewBuffer), "$%s:%s", item->nameURI, item->name); } if (printVariableValue == 0){ xsldbgGenericErrorFunc(i18n(" Local %1").arg(xsldbgText(fullQualifiedName))); }else{ if (item->computed == 1){ xsldbgGenericErrorFunc(i18n(" Local ")); printXPathObject(item->value, fullQualifiedName); }else if (item->tree){ xsldbgGenericErrorFunc(i18n(" Local = %1\n").arg(xsldbgText(fullQualifiedName))); xslDbgCatToFile(item->tree, stderr); }else if (item->select){ xsldbgGenericErrorFunc(i18n(" Local = %1\n%2").arg(xsldbgText(fullQualifiedName)).arg(xsldbgText(item->select))); }else{ /* can't find a value give only a variable name and an error */ xsldbgGenericErrorFunc(i18n(" Local = %1\n%2").arg(xsldbgText(fullQualifiedName)).arg(i18n("Warning: No value assigned to variable.\n"))); } } xsltGenericError(xsltGenericErrorContext, "\n\032\032\n"); } item = item->next; } } } result = 1; xsltGenericError(xsltGenericErrorContext, "\n"); } else { if (getThreadStatus() != XSLDBG_MSG_THREAD_RUN) { /* Don't show this message when running as a thread as it * is annoying */ xsldbgGenericErrorFunc(i18n("Error: Libxslt has not initialized variables yet; try stepping past the xsl:param elements in the template.\n")); } else { /* send an empty list */ notifyListStart(XSLDBG_MSG_LOCALVAR_CHANGED); notifyListSend(); result = 1; } } } } else { /* Display the value of variable */ if (arg[0] == '$') { printXPathObject(xmlXPathEval(arg, styleCtxt->xpathCtxt), arg); xsltGenericError(xsltGenericErrorContext, "\032\032\n"); } else { xmlStrCpy(nodeViewBuffer, "$"); xmlStrCat(nodeViewBuffer, arg); printXPathObject(xmlXPathEval((xmlChar*)nodeViewBuffer,styleCtxt->xpathCtxt), (xmlChar*)nodeViewBuffer); xsltGenericError(xsltGenericErrorContext, "\032\032\n"); } } printVariableValue = 0; return result; }