xmlStrstr args are both const small cleanup reformated, fixed problems if
* include/libxml/parser.h parser.c: xmlStrstr args are both const
* xpath.c: small cleanup
* xmlGetNsList: reformated, fixed problems if used on Entities
Daniel
diff --git a/ChangeLog b/ChangeLog
index 22f582b..e3afa45 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Fri Jun 29 23:26:54 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
+
+ * include/libxml/parser.h parser.c: xmlStrstr args are both const
+ * xpath.c: small cleanup
+ * xmlGetNsList: reformated, fixed problems if used on Entities
+
Thu Jun 28 18:19:44 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* doc/xml.html: added 1.8.14 and 2.3.13 releases
diff --git a/Makefile.am b/Makefile.am
index 100fc92..dec5b2a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,7 @@
## Process this file with automake to produce Makefile.in
-AUTOMAKE_OPTIONS=no-dependencies
+
+# Dependancies are fucked in make distcheck could not find why :-(
+# AUTOMAKE_OPTIONS=no-dependencies
SUBDIRS = include . doc example
diff --git a/aclocal.m4 b/aclocal.m4
index 869e5fc..e372675 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -620,31 +620,35 @@
])
# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
-# the libltdl convenience library, adds --enable-ltdl-convenience to
-# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
-# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
-# to be `${top_builddir}/libltdl'. Make sure you start DIR with
-# '${top_builddir}/' (note the single quotes!) if your package is not
-# flat, and, if you're not using automake, define top_builddir as
-# appropriate in the Makefiles.
+# the libltdl convenience library and INCLTDL to the include flags for
+# the libltdl header and adds --enable-ltdl-convenience to the
+# configure arguments. Note that LIBLTDL and INCLTDL are not
+# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not
+# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed
+# with '${top_builddir}/' and INCLTDL will be prefixed with
+# '${top_srcdir}/' (note the single quotes!). If your package is not
+# flat and you're not using automake, define top_builddir and
+# top_srcdir appropriately in the Makefiles.
AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
case "$enable_ltdl_convenience" in
no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
"") enable_ltdl_convenience=yes
ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
esac
- LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
- INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
+ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
+ INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
])
# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
-# the libltdl installable library, and adds --enable-ltdl-install to
-# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
-# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
-# to be `${top_builddir}/libltdl'. Make sure you start DIR with
-# '${top_builddir}/' (note the single quotes!) if your package is not
-# flat, and, if you're not using automake, define top_builddir as
-# appropriate in the Makefiles.
+# the libltdl installable library and INCLTDL to the include flags for
+# the libltdl header and adds --enable-ltdl-install to the configure
+# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
+# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed
+# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will
+# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
+# with '${top_srcdir}/' (note the single quotes!). If your package is
+# not flat and you're not using automake, define top_builddir and
+# top_srcdir appropriately in the Makefiles.
# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
AC_CHECK_LIB(ltdl, main,
@@ -657,8 +661,8 @@
])
if test x"$enable_ltdl_install" = x"yes"; then
ac_configure_args="$ac_configure_args --enable-ltdl-install"
- LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
- INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
+ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
+ INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
else
ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
LIBLTDL="-lltdl"
diff --git a/include/libxml/parser.h b/include/libxml/parser.h
index 5ff8ab6..f3ae597 100644
--- a/include/libxml/parser.h
+++ b/include/libxml/parser.h
@@ -381,7 +381,7 @@
const xmlChar * xmlStrchr (const xmlChar *str,
xmlChar val);
const xmlChar * xmlStrstr (const xmlChar *str,
- xmlChar *val);
+ const xmlChar *val);
const xmlChar * xmlStrcasestr (const xmlChar *str,
xmlChar *val);
int xmlStrcmp (const xmlChar *str1,
diff --git a/parser.c b/parser.c
index a22eb4e..8d34e72 100644
--- a/parser.c
+++ b/parser.c
@@ -1271,7 +1271,7 @@
*/
const xmlChar *
-xmlStrstr(const xmlChar *str, xmlChar *val) {
+xmlStrstr(const xmlChar *str, const xmlChar *val) {
int n;
if (str == NULL) return(NULL);
diff --git a/tree.c b/tree.c
index 6accfbc..1242e9c 100644
--- a/tree.c
+++ b/tree.c
@@ -3823,7 +3823,8 @@
* namespace if defined
*/
xmlNsPtr *
-xmlGetNsList(xmlDocPtr doc ATTRIBUTE_UNUSED, xmlNodePtr node) {
+xmlGetNsList(xmlDocPtr doc ATTRIBUTE_UNUSED, xmlNodePtr node)
+{
xmlNsPtr cur;
xmlNsPtr *ret = NULL;
int nbns = 0;
@@ -3831,41 +3832,48 @@
int i;
while (node != NULL) {
- cur = node->nsDef;
- while (cur != NULL) {
- if (ret == NULL) {
- ret = (xmlNsPtr *) xmlMalloc((maxns + 1) * sizeof(xmlNsPtr));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlGetNsList : out of memory!\n");
- return(NULL);
- }
- ret[nbns] = NULL;
- }
- for (i = 0;i < nbns;i++) {
- if ((cur->prefix == ret[i]->prefix) ||
- (xmlStrEqual(cur->prefix, ret[i]->prefix))) break;
- }
- if (i >= nbns) {
- if (nbns >= maxns) {
- maxns *= 2;
- ret = (xmlNsPtr *) xmlRealloc(ret,
- (maxns + 1) * sizeof(xmlNsPtr));
- if (ret == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlGetNsList : realloc failed!\n");
- return(NULL);
- }
- }
- ret[nbns++] = cur;
- ret[nbns] = NULL;
- }
+ if (node->type == XML_ELEMENT_NODE) {
+ cur = node->nsDef;
+ while (cur != NULL) {
+ if (ret == NULL) {
+ ret =
+ (xmlNsPtr *) xmlMalloc((maxns + 1) *
+ sizeof(xmlNsPtr));
+ if (ret == NULL) {
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlGetNsList : out of memory!\n");
+ return (NULL);
+ }
+ ret[nbns] = NULL;
+ }
+ for (i = 0; i < nbns; i++) {
+ if ((cur->prefix == ret[i]->prefix) ||
+ (xmlStrEqual(cur->prefix, ret[i]->prefix)))
+ break;
+ }
+ if (i >= nbns) {
+ if (nbns >= maxns) {
+ maxns *= 2;
+ ret = (xmlNsPtr *) xmlRealloc(ret,
+ (maxns +
+ 1) *
+ sizeof(xmlNsPtr));
+ if (ret == NULL) {
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlGetNsList : realloc failed!\n");
+ return (NULL);
+ }
+ }
+ ret[nbns++] = cur;
+ ret[nbns] = NULL;
+ }
- cur = cur->next;
- }
- node = node->parent;
+ cur = cur->next;
+ }
+ }
+ node = node->parent;
}
- return(ret);
+ return (ret);
}
/**
diff --git a/xpath.c b/xpath.c
index 0741920..0764703 100644
--- a/xpath.c
+++ b/xpath.c
@@ -7449,6 +7449,7 @@
break;
}
break;
+ break;
}
} while (cur != NULL);