cvs: php4 /ext/dom php_dom.c
| From: | Marcus Boerger | Date: | Mon, 16 Jun 2003 00:18:29 +0000 |
| Subject: | cvs: php4 /ext/dom php_dom.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-21767@lists.php.net to get a copy of this message | ||
helly Sun Jun 15 20:18:29 2003 EDT
Modified files:
/php4/ext/dom php_dom.c
Log:
Fit the error handler into the naming scheme and get rid of trailing new lines
Index: php4/ext/dom/php_dom.c
diff -u php4/ext/dom/php_dom.c:1.14 php4/ext/dom/php_dom.c:1.15
--- php4/ext/dom/php_dom.c:1.14 Sun Jun 15 19:57:48 2003
+++ php4/ext/dom/php_dom.c Sun Jun 15 20:18:28 2003
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_dom.c,v 1.14 2003/06/15 23:57:48 helly Exp $ */
+/* $Id: php_dom.c,v 1.15 2003/06/16 00:18:28 helly Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -284,15 +284,21 @@
ZEND_GET_MODULE(dom)
#endif
-/* {{{ _phpXmlParserErrorCb */
-static void _phpXmlParserErrorCb(void *ctx, const char *msg, ...) {
+/* {{{ php_dom_error_func */
+static void php_dom_error_func(void *ctx, const char *msg, ...) {
va_list ap;
char *buf;
+ int len;
TSRMLS_FETCH();
va_start(ap, msg);
- vspprintf(&buf, 0, msg, ap);
+ len = vspprintf(&buf, 0, msg, ap);
va_end(ap);
+
+ /* remove any trailing \n */
+ while (len && buf[--len] == '\n') {
+ buf[len] = '\0';
+ }
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", buf);
efree(buf);
}
@@ -534,7 +540,7 @@
REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_NOTATION", XML_ATTRIBUTE_NOTATION, CONST_CS |
CONST_PERSISTENT);
xmlInitParser();
- xmlSetGenericErrorFunc((void*) NULL, _phpXmlParserErrorCb);
+ xmlSetGenericErrorFunc((void*) NULL, php_dom_error_func);
return SUCCESS;
}