mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-21 14:53:44 +03:00
fixed the bug in lang() as raised by Elliotte Rusty Harold added a
* xpath.c: fixed the bug in lang() as raised by Elliotte Rusty Harold * result/XPath/tests/langsimple test/XPath/tests/langsimple test/XPath/docs/lang: added a regression test Daniel
This commit is contained in:
10
xpath.c
10
xpath.c
@@ -7092,8 +7092,8 @@ xmlXPathFalseFunction(xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
*/
|
||||
void
|
||||
xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
xmlXPathObjectPtr val;
|
||||
const xmlChar *theLang;
|
||||
xmlXPathObjectPtr val = NULL;
|
||||
const xmlChar *theLang = NULL;
|
||||
const xmlChar *lang;
|
||||
int ret = 0;
|
||||
int i;
|
||||
@@ -7108,10 +7108,12 @@ xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
for (i = 0;lang[i] != 0;i++)
|
||||
if (toupper(lang[i]) != toupper(theLang[i]))
|
||||
goto not_equal;
|
||||
ret = 1;
|
||||
if ((theLang[i] == 0) || (theLang[i] == '-'))
|
||||
ret = 1;
|
||||
}
|
||||
not_equal:
|
||||
xmlFree((void *)theLang);
|
||||
if (theLang != NULL)
|
||||
xmlFree((void *)theLang);
|
||||
xmlXPathFreeObject(val);
|
||||
valuePush(ctxt, xmlXPathNewBoolean(ret));
|
||||
}
|
||||
|
Reference in New Issue
Block a user