1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-24 13:33:01 +03:00

parser: Rename internal xmlNewInput functions

This commit is contained in:
Nick Wellnhofer
2024-07-06 22:04:06 +02:00
parent 4f329dc524
commit d74ca59491
4 changed files with 90 additions and 83 deletions

View File

@@ -4996,9 +4996,6 @@ htmlFreeParserCtxt(htmlParserCtxtPtr ctxt)
*
* See xmlCtxtSetErrorHandler for advanced error handling.
*
* See xmlNewInputURL, xmlNewInputMemory, xmlNewInputIO and similar
* functions for advanced input control.
*
* See htmlNewSAXParserCtxt for custom SAX parsers.
*
* Returns the htmlParserCtxtPtr or NULL in case of allocation error
@@ -5059,7 +5056,7 @@ htmlCreateMemoryParserCtxtInternal(const char *url,
if (ctxt == NULL)
return(NULL);
input = xmlNewInputMemory(ctxt, url, buffer, size, encoding, 0);
input = xmlCtxtNewInputFromMemory(ctxt, url, buffer, size, encoding, 0);
if (input == NULL) {
xmlFreeParserCtxt(ctxt);
return(NULL);
@@ -5116,7 +5113,8 @@ htmlCreateDocParserCtxt(const xmlChar *str, const char *url,
if (ctxt == NULL)
return(NULL);
input = xmlNewInputString(ctxt, url, (const char *) str, encoding, 0);
input = xmlCtxtNewInputFromString(ctxt, url, (const char *) str,
encoding, 0);
if (input == NULL) {
xmlFreeParserCtxt(ctxt);
return(NULL);
@@ -5960,7 +5958,7 @@ htmlCreateFileParserCtxt(const char *filename, const char *encoding)
return(NULL);
}
input = xmlNewInputURL(ctxt, filename, NULL, encoding, 0);
input = xmlCtxtNewInputFromUrl(ctxt, filename, NULL, encoding, 0);
if (input == NULL) {
xmlFreeParserCtxt(ctxt);
return(NULL);
@@ -6026,8 +6024,6 @@ htmlSAXParseFile(const char *filename, const char *encoding, htmlSAXHandlerPtr s
*
* Parse an HTML file and build a tree.
*
* See xmlNewInputURL for details.
*
* Returns the resulting document tree
*/
@@ -6426,7 +6422,7 @@ htmlReadDoc(const xmlChar *str, const char *url, const char *encoding,
htmlCtxtUseOptions(ctxt, options);
input = xmlNewInputString(ctxt, url, (const char *) str, encoding,
input = xmlCtxtNewInputFromString(ctxt, url, (const char *) str, encoding,
XML_INPUT_BUF_STATIC);
doc = htmlCtxtParseDocument(ctxt, input);
@@ -6461,7 +6457,7 @@ htmlReadFile(const char *filename, const char *encoding, int options)
htmlCtxtUseOptions(ctxt, options);
input = xmlNewInputURL(ctxt, filename, NULL, encoding, 0);
input = xmlCtxtNewInputFromUrl(ctxt, filename, NULL, encoding, 0);
doc = htmlCtxtParseDocument(ctxt, input);
@@ -6501,7 +6497,7 @@ htmlReadMemory(const char *buffer, int size, const char *url,
htmlCtxtUseOptions(ctxt, options);
input = xmlNewInputMemory(ctxt, url, buffer, size, encoding,
input = xmlCtxtNewInputFromMemory(ctxt, url, buffer, size, encoding,
XML_INPUT_BUF_STATIC);
doc = htmlCtxtParseDocument(ctxt, input);
@@ -6540,7 +6536,7 @@ htmlReadFd(int fd, const char *url, const char *encoding, int options)
htmlCtxtUseOptions(ctxt, options);
input = xmlNewInputFd(ctxt, url, fd, encoding, 0);
input = xmlCtxtNewInputFromFd(ctxt, url, fd, encoding, 0);
doc = htmlCtxtParseDocument(ctxt, input);
@@ -6578,7 +6574,8 @@ htmlReadIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose,
htmlCtxtUseOptions(ctxt, options);
input = xmlNewInputIO(ctxt, url, ioread, ioclose, ioctx, encoding, 0);
input = xmlCtxtNewInputFromIO(ctxt, url, ioread, ioclose, ioctx,
encoding, 0);
doc = htmlCtxtParseDocument(ctxt, input);
@@ -6612,7 +6609,8 @@ htmlCtxtReadDoc(htmlParserCtxtPtr ctxt, const xmlChar *str,
htmlCtxtReset(ctxt);
htmlCtxtUseOptions(ctxt, options);
input = xmlNewInputString(ctxt, URL, (const char *) str, encoding, 0);
input = xmlCtxtNewInputFromString(ctxt, URL, (const char *) str,
encoding, 0);
return(htmlCtxtParseDocument(ctxt, input));
}
@@ -6627,7 +6625,7 @@ htmlCtxtReadDoc(htmlParserCtxtPtr ctxt, const xmlChar *str,
* Parse an HTML file from the filesystem, the network or a
* user-defined resource loader.
*
* See xmlNewInputURL and htmlCtxtUseOptions for details.
* See htmlCtxtUseOptions for details.
*
* Returns the resulting document tree
*/
@@ -6643,7 +6641,7 @@ htmlCtxtReadFile(htmlParserCtxtPtr ctxt, const char *filename,
htmlCtxtReset(ctxt);
htmlCtxtUseOptions(ctxt, options);
input = xmlNewInputURL(ctxt, filename, NULL, encoding, 0);
input = xmlCtxtNewInputFromUrl(ctxt, filename, NULL, encoding, 0);
return(htmlCtxtParseDocument(ctxt, input));
}
@@ -6676,7 +6674,7 @@ htmlCtxtReadMemory(htmlParserCtxtPtr ctxt, const char *buffer, int size,
htmlCtxtReset(ctxt);
htmlCtxtUseOptions(ctxt, options);
input = xmlNewInputMemory(ctxt, URL, buffer, size, encoding,
input = xmlCtxtNewInputFromMemory(ctxt, URL, buffer, size, encoding,
XML_INPUT_BUF_STATIC);
return(htmlCtxtParseDocument(ctxt, input));
@@ -6711,7 +6709,7 @@ htmlCtxtReadFd(htmlParserCtxtPtr ctxt, int fd,
htmlCtxtReset(ctxt);
htmlCtxtUseOptions(ctxt, options);
input = xmlNewInputFd(ctxt, URL, fd, encoding, 0);
input = xmlCtxtNewInputFromFd(ctxt, URL, fd, encoding, 0);
return(htmlCtxtParseDocument(ctxt, input));
}
@@ -6728,7 +6726,7 @@ htmlCtxtReadFd(htmlParserCtxtPtr ctxt, int fd,
*
* Parse an HTML document from I/O functions and source and build a tree.
*
* See xmlNewInputIO and htmlCtxtUseOptions for details.
* See htmlCtxtUseOptions for details.
*
* Returns the resulting document tree
*/
@@ -6746,7 +6744,8 @@ htmlCtxtReadIO(htmlParserCtxtPtr ctxt, xmlInputReadCallback ioread,
htmlCtxtReset(ctxt);
htmlCtxtUseOptions(ctxt, options);
input = xmlNewInputIO(ctxt, URL, ioread, ioclose, ioctx, encoding, 0);
input = xmlCtxtNewInputFromIO(ctxt, URL, ioread, ioclose, ioctx,
encoding, 0);
return(htmlCtxtParseDocument(ctxt, input));
}

View File

@@ -96,20 +96,20 @@ XML_HIDDEN xmlParserInputPtr
xmlLoadResource(xmlParserCtxtPtr ctxt, const char *url, const char *publicId,
xmlResourceType type);
XML_HIDDEN xmlParserInputPtr
xmlNewInputURL(xmlParserCtxtPtr ctxt, const char *url, const char *publicId,
const char *encoding, int flags);
xmlCtxtNewInputFromUrl(xmlParserCtxtPtr ctxt, const char *url,
const char *publicId, const char *encoding, int flags);
XML_HIDDEN xmlParserInputPtr
xmlNewInputMemory(xmlParserCtxtPtr ctxt, const char *url,
xmlCtxtNewInputFromMemory(xmlParserCtxtPtr ctxt, const char *url,
const void *mem, size_t size,
const char *encoding, int flags);
XML_HIDDEN xmlParserInputPtr
xmlNewInputString(xmlParserCtxtPtr ctxt, const char *url, const char *str,
xmlCtxtNewInputFromString(xmlParserCtxtPtr ctxt, const char *url,
const char *str, const char *encoding, int flags);
XML_HIDDEN xmlParserInputPtr
xmlCtxtNewInputFromFd(xmlParserCtxtPtr ctxt, const char *filename, int fd,
const char *encoding, int flags);
XML_HIDDEN xmlParserInputPtr
xmlNewInputFd(xmlParserCtxtPtr ctxt, const char *filename, int fd,
const char *encoding, int flags);
XML_HIDDEN xmlParserInputPtr
xmlNewInputIO(xmlParserCtxtPtr ctxt, const char *url,
xmlCtxtNewInputFromIO(xmlParserCtxtPtr ctxt, const char *url,
xmlInputReadCallback ioRead,
xmlInputCloseCallback ioClose,
void *ioCtxt,

View File

@@ -11754,7 +11754,8 @@ xmlCreateIOParserCtxt(xmlSAXHandlerPtr sax, void *user_data,
return(NULL);
encoding = xmlGetCharEncodingName(enc);
input = xmlNewInputIO(ctxt, NULL, ioread, ioclose, ioctx, encoding, 0);
input = xmlCtxtNewInputFromIO(ctxt, NULL, ioread, ioclose, ioctx,
encoding, 0);
if (input == NULL) {
xmlFreeParserCtxt(ctxt);
return (NULL);
@@ -12518,7 +12519,7 @@ xmlParseInNodeContext(xmlNodePtr node, const char *data, int datalen,
if (ctxt == NULL)
return(XML_ERR_NO_MEMORY);
input = xmlNewInputMemory(ctxt, NULL, data, datalen,
input = xmlCtxtNewInputFromMemory(ctxt, NULL, data, datalen,
(const char *) doc->encoding,
XML_INPUT_BUF_STATIC);
if (input == NULL) {
@@ -12847,9 +12848,9 @@ xmlSAXParseFileWithData(xmlSAXHandlerPtr sax, const char *filename,
}
if ((filename != NULL) && (filename[0] == '-') && (filename[1] == 0))
input = xmlNewInputFd(ctxt, filename, STDIN_FILENO, NULL, 0);
input = xmlCtxtNewInputFromFd(ctxt, filename, STDIN_FILENO, NULL, 0);
else
input = xmlNewInputURL(ctxt, filename, NULL, NULL, 0);
input = xmlCtxtNewInputFromUrl(ctxt, filename, NULL, NULL, 0);
ret = xmlCtxtParseDocument(ctxt, input);
@@ -12959,7 +12960,8 @@ xmlSetupParserForBuffer(xmlParserCtxtPtr ctxt, const xmlChar* buffer,
xmlClearParserCtxt(ctxt);
input = xmlNewInputString(ctxt, filename, (const char *) buffer, NULL, 0);
input = xmlCtxtNewInputFromString(ctxt, filename, (const char *) buffer,
NULL, 0);
if (input == NULL)
return;
if (inputPush(ctxt, input) < 0)
@@ -13045,7 +13047,7 @@ xmlCreateMemoryParserCtxt(const char *buffer, int size) {
if (ctxt == NULL)
return(NULL);
input = xmlNewInputMemory(ctxt, NULL, buffer, size, NULL, 0);
input = xmlCtxtNewInputFromMemory(ctxt, NULL, buffer, size, NULL, 0);
if (input == NULL) {
xmlFreeParserCtxt(ctxt);
return(NULL);
@@ -13103,7 +13105,7 @@ xmlSAXParseMemoryWithData(xmlSAXHandlerPtr sax, const char *buffer,
ctxt->recovery = 1;
}
input = xmlNewInputMemory(ctxt, NULL, buffer, size, NULL,
input = xmlCtxtNewInputFromMemory(ctxt, NULL, buffer, size, NULL,
XML_INPUT_BUF_STATIC);
ret = xmlCtxtParseDocument(ctxt, input);
@@ -13235,7 +13237,7 @@ xmlCreateDocParserCtxt(const xmlChar *str) {
if (ctxt == NULL)
return(NULL);
input = xmlNewInputString(ctxt, NULL, (const char *) str, NULL, 0);
input = xmlCtxtNewInputFromString(ctxt, NULL, (const char *) str, NULL, 0);
if (input == NULL) {
xmlFreeParserCtxt(ctxt);
return(NULL);
@@ -13896,7 +13898,7 @@ xmlReadDoc(const xmlChar *cur, const char *URL, const char *encoding,
xmlCtxtUseOptions(ctxt, options);
input = xmlNewInputString(ctxt, URL, (const char *) cur, encoding,
input = xmlCtxtNewInputFromString(ctxt, URL, (const char *) cur, encoding,
XML_INPUT_BUF_STATIC);
doc = xmlCtxtParseDocument(ctxt, input);
@@ -13937,9 +13939,10 @@ xmlReadFile(const char *filename, const char *encoding, int options)
* should be removed at some point.
*/
if ((filename != NULL) && (filename[0] == '-') && (filename[1] == 0))
input = xmlNewInputFd(ctxt, filename, STDIN_FILENO, encoding, 0);
input = xmlCtxtNewInputFromFd(ctxt, filename, STDIN_FILENO,
encoding, 0);
else
input = xmlNewInputURL(ctxt, filename, NULL, encoding, 0);
input = xmlCtxtNewInputFromUrl(ctxt, filename, NULL, encoding, 0);
doc = xmlCtxtParseDocument(ctxt, input);
@@ -13979,7 +13982,7 @@ xmlReadMemory(const char *buffer, int size, const char *url,
xmlCtxtUseOptions(ctxt, options);
input = xmlNewInputMemory(ctxt, url, buffer, size, encoding,
input = xmlCtxtNewInputFromMemory(ctxt, url, buffer, size, encoding,
XML_INPUT_BUF_STATIC);
doc = xmlCtxtParseDocument(ctxt, input);
@@ -14017,7 +14020,7 @@ xmlReadFd(int fd, const char *URL, const char *encoding, int options)
xmlCtxtUseOptions(ctxt, options);
input = xmlNewInputFd(ctxt, URL, fd, encoding, 0);
input = xmlCtxtNewInputFromFd(ctxt, URL, fd, encoding, 0);
doc = xmlCtxtParseDocument(ctxt, input);
@@ -14054,7 +14057,8 @@ xmlReadIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose,
xmlCtxtUseOptions(ctxt, options);
input = xmlNewInputIO(ctxt, URL, ioread, ioclose, ioctx, encoding, 0);
input = xmlCtxtNewInputFromIO(ctxt, URL, ioread, ioclose, ioctx,
encoding, 0);
doc = xmlCtxtParseDocument(ctxt, input);
@@ -14091,7 +14095,7 @@ xmlCtxtReadDoc(xmlParserCtxtPtr ctxt, const xmlChar *str,
xmlCtxtReset(ctxt);
xmlCtxtUseOptions(ctxt, options);
input = xmlNewInputString(ctxt, URL, (const char *) str, encoding,
input = xmlCtxtNewInputFromString(ctxt, URL, (const char *) str, encoding,
XML_INPUT_BUF_STATIC);
return(xmlCtxtParseDocument(ctxt, input));
@@ -14121,7 +14125,7 @@ xmlCtxtReadFile(xmlParserCtxtPtr ctxt, const char *filename,
xmlCtxtReset(ctxt);
xmlCtxtUseOptions(ctxt, options);
input = xmlNewInputURL(ctxt, filename, NULL, encoding, 0);
input = xmlCtxtNewInputFromUrl(ctxt, filename, NULL, encoding, 0);
return(xmlCtxtParseDocument(ctxt, input));
}
@@ -14157,7 +14161,7 @@ xmlCtxtReadMemory(xmlParserCtxtPtr ctxt, const char *buffer, int size,
xmlCtxtReset(ctxt);
xmlCtxtUseOptions(ctxt, options);
input = xmlNewInputMemory(ctxt, URL, buffer, size, encoding,
input = xmlCtxtNewInputFromMemory(ctxt, URL, buffer, size, encoding,
XML_INPUT_BUF_STATIC);
return(xmlCtxtParseDocument(ctxt, input));
@@ -14195,7 +14199,7 @@ xmlCtxtReadFd(xmlParserCtxtPtr ctxt, int fd,
xmlCtxtReset(ctxt);
xmlCtxtUseOptions(ctxt, options);
input = xmlNewInputFd(ctxt, URL, fd, encoding, 0);
input = xmlCtxtNewInputFromFd(ctxt, URL, fd, encoding, 0);
return(xmlCtxtParseDocument(ctxt, input));
}
@@ -14234,7 +14238,8 @@ xmlCtxtReadIO(xmlParserCtxtPtr ctxt, xmlInputReadCallback ioread,
xmlCtxtReset(ctxt);
xmlCtxtUseOptions(ctxt, options);
input = xmlNewInputIO(ctxt, URL, ioread, ioclose, ioctx, encoding, 0);
input = xmlCtxtNewInputFromIO(ctxt, URL, ioread, ioclose, ioctx,
encoding, 0);
return(xmlCtxtParseDocument(ctxt, input));
}

View File

@@ -1705,7 +1705,7 @@ xmlNewInputStream(xmlParserCtxtPtr ctxt) {
}
/**
* xmlNewInputURL:
* xmlCtxtNewInputFromUrl:
* @ctxt: parser context
* @url: filename or URL
* @publicId: publid ID from doctype (optional)
@@ -1718,8 +1718,9 @@ xmlNewInputStream(xmlParserCtxtPtr ctxt) {
* Returns a new parser input.
*/
xmlParserInputPtr
xmlNewInputURL(xmlParserCtxtPtr ctxt, const char *url, const char *publicId,
const char *encoding, int flags ATTRIBUTE_UNUSED) {
xmlCtxtNewInputFromUrl(xmlParserCtxtPtr ctxt, const char *url,
const char *publicId, const char *encoding,
int flags ATTRIBUTE_UNUSED) {
xmlParserInputPtr input;
if ((ctxt == NULL) || (url == NULL))
@@ -1811,7 +1812,7 @@ xmlInputCreateMemory(const char *url, const void *mem, size_t size,
}
/**
* xmlNewInputMemory:
* xmlCtxtNewInputFromMemory:
* @ctxt: parser context
* @url: base URL (optional)
* @mem: pointer to char array
@@ -1822,7 +1823,7 @@ xmlInputCreateMemory(const char *url, const void *mem, size_t size,
* Returns a new parser input or NULL in case of error.
*/
xmlParserInputPtr
xmlNewInputMemory(xmlParserCtxtPtr ctxt, const char *url,
xmlCtxtNewInputFromMemory(xmlParserCtxtPtr ctxt, const char *url,
const void *mem, size_t size,
const char *encoding, int flags) {
xmlParserInputPtr input;
@@ -1876,7 +1877,7 @@ xmlInputCreateString(const char *url, const char *str, int flags) {
}
/**
* xmlNewInputString:
* xmlCtxtNewInputFromString:
* @ctxt: parser context
* @url: base URL (optional)
* @str: zero-terminated string
@@ -1886,7 +1887,7 @@ xmlInputCreateString(const char *url, const char *str, int flags) {
* Returns a new parser input.
*/
xmlParserInputPtr
xmlNewInputString(xmlParserCtxtPtr ctxt, const char *url,
xmlCtxtNewInputFromString(xmlParserCtxtPtr ctxt, const char *url,
const char *str, const char *encoding, int flags) {
xmlParserInputPtr input;
@@ -1937,7 +1938,7 @@ xmlInputCreateFd(const char *url, int fd, int flags ATTRIBUTE_UNUSED) {
}
/**
* xmlNewInputFd:
* xmlCtxtNewInputFromFd:
* @ctxt: parser context
* @url: base URL (optional)
* @fd: file descriptor
@@ -1947,7 +1948,7 @@ xmlInputCreateFd(const char *url, int fd, int flags ATTRIBUTE_UNUSED) {
* Returns a new parser input.
*/
xmlParserInputPtr
xmlNewInputFd(xmlParserCtxtPtr ctxt, const char *url,
xmlCtxtNewInputFromFd(xmlParserCtxtPtr ctxt, const char *url,
int fd, const char *encoding, int flags) {
xmlParserInputPtr input;
@@ -2016,7 +2017,7 @@ xmlInputCreateIO(const char *url, xmlInputReadCallback ioRead,
}
/**
* xmlNewInputIO:
* xmlCtxtNewInputFromIO:
* @ctxt: parser context
* @url: base URL (optional)
* @ioRead: read callback
@@ -2028,8 +2029,9 @@ xmlInputCreateIO(const char *url, xmlInputReadCallback ioRead,
* Returns a new parser input.
*/
xmlParserInputPtr
xmlNewInputIO(xmlParserCtxtPtr ctxt, const char *url,
xmlInputReadCallback ioRead, xmlInputCloseCallback ioClose,
xmlCtxtNewInputFromIO(xmlParserCtxtPtr ctxt, const char *url,
xmlInputReadCallback ioRead,
xmlInputCloseCallback ioClose,
void *ioCtxt, const char *encoding, int flags) {
xmlParserInputPtr input;
@@ -2139,8 +2141,8 @@ xmlNewEntityInputStream(xmlParserCtxtPtr ctxt, xmlEntityPtr ent) {
return(NULL);
if (ent->content != NULL) {
input = xmlNewInputString(ctxt, NULL, (const char *) ent->content,
NULL, XML_INPUT_BUF_STATIC);
input = xmlCtxtNewInputFromString(ctxt, NULL,
(const char *) ent->content, NULL, XML_INPUT_BUF_STATIC);
} else if (ent->URI != NULL) {
xmlResourceType rtype;
@@ -2176,7 +2178,8 @@ xmlNewEntityInputStream(xmlParserCtxtPtr ctxt, xmlEntityPtr ent) {
*/
xmlParserInputPtr
xmlNewStringInputStream(xmlParserCtxtPtr ctxt, const xmlChar *buffer) {
return(xmlNewInputString(ctxt, NULL, (const char *) buffer, NULL, 0));
return(xmlCtxtNewInputFromString(ctxt, NULL, (const char *) buffer,
NULL, 0));
}