* xmlParserNsPop: * @ctxt: an XML parser context * @nr: the number to pop * * Pops the top @nr namespaces and restores the hash table. * * Returns the number of namespaces popped. */
| 1870 | * Returns the number of namespaces popped. |
| 1871 | */ |
| 1872 | static int |
| 1873 | xmlParserNsPop(xmlParserCtxtPtr ctxt, int nr) |
| 1874 | { |
| 1875 | int i; |
| 1876 | |
| 1877 | /* assert(nr <= ctxt->nsNr); */ |
| 1878 | |
| 1879 | for (i = ctxt->nsNr - 1; i >= ctxt->nsNr - nr; i--) { |
| 1880 | const xmlChar *prefix = ctxt->nsTab[i * 2]; |
| 1881 | xmlParserNsExtra *extra = &ctxt->nsdb->extra[i]; |
| 1882 | |
| 1883 | if (prefix == NULL) { |
| 1884 | ctxt->nsdb->defaultNsIndex = extra->oldIndex; |
| 1885 | } else { |
| 1886 | xmlHashedString hprefix; |
| 1887 | xmlParserNsBucket *bucket = NULL; |
| 1888 | |
| 1889 | hprefix.name = prefix; |
| 1890 | hprefix.hashValue = extra->prefixHashValue; |
| 1891 | xmlParserNsLookup(ctxt, &hprefix, &bucket); |
| 1892 | /* assert(bucket && bucket->hashValue); */ |
| 1893 | bucket->index = extra->oldIndex; |
| 1894 | } |
| 1895 | } |
| 1896 | |
| 1897 | ctxt->nsNr -= nr; |
| 1898 | return(nr); |
| 1899 | } |
| 1900 | |
| 1901 | static int |
| 1902 | xmlCtxtGrowAttrs(xmlParserCtxtPtr ctxt, int nr) { |
no test coverage detected