/* Interface to libxml2.
- Copyright (C) 2010-2012 Free Software Foundation, Inc.
+ Copyright (C) 2010-2013 Free Software Foundation, Inc.
This file is part of GNU Emacs.
#define fn_xmlCleanupParser xmlCleanupParser
#define fn_xmlCheckVersion xmlCheckVersion
-static inline int
+static int
libxml2_loaded_p (void)
{
return 1;
if (!(library = w32_delayed_load (Qlibxml2_dll)))
{
- message ("%s", "libxml2 library not found");
+ message1 ("libxml2 library not found");
return 0;
}
{
if (node->type == XML_ELEMENT_NODE)
{
- Lisp_Object result = Fcons (intern ((char *) node->name), Qnil);
+ Lisp_Object result = list1 (intern ((char *) node->name));
xmlNode *child;
xmlAttr *property;
Lisp_Object plist = Qnil;
xmlDoc *doc;
Lisp_Object result = Qnil;
const char *burl = "";
- ptrdiff_t bytes;
- ptrdiff_t istart, iend;
+ ptrdiff_t istart, iend, istart_byte, iend_byte;
fn_xmlCheckVersion (LIBXML_VERSION);
istart = XINT (start);
iend = XINT (end);
+ istart_byte = CHAR_TO_BYTE (istart);
+ iend_byte = CHAR_TO_BYTE (iend);
if (istart < GPT && GPT < iend)
- move_gap (iend);
+ move_gap_both (iend, iend_byte);
if (! NILP (base_url))
{
burl = SSDATA (base_url);
}
- bytes = CHAR_TO_BYTE (iend) - CHAR_TO_BYTE (istart);
-
if (htmlp)
- doc = fn_htmlReadMemory ((char *) BYTE_POS_ADDR (CHAR_TO_BYTE (istart)),
- bytes, burl, "utf-8",
+ doc = fn_htmlReadMemory ((char *) BYTE_POS_ADDR (istart_byte),
+ iend_byte - istart_byte, burl, "utf-8",
HTML_PARSE_RECOVER|HTML_PARSE_NONET|
HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR|
HTML_PARSE_NOBLANKS);
else
- doc = fn_xmlReadMemory ((char *) BYTE_POS_ADDR (CHAR_TO_BYTE (istart)),
- bytes, burl, "utf-8",
+ doc = fn_xmlReadMemory ((char *) BYTE_POS_ADDR (istart_byte),
+ iend_byte - istart_byte, burl, "utf-8",
XML_PARSE_NONET|XML_PARSE_NOWARNING|
XML_PARSE_NOBLANKS |XML_PARSE_NOERROR);