From: Marcus Boerger Date: Mon, 16 Jun 2003 00:18:28 +0000 (+0000) Subject: Fit the error handler into the naming scheme and get rid of trailing new lines X-Git-Tag: RELEASE_1_0_2~213 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=46b4ab47be2dbb53c82c911308b6a8b1ebd48163;p=php Fit the error handler into the naming scheme and get rid of trailing new lines --- diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index 67b528e2d1..f811ef892d 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -284,15 +284,21 @@ zend_module_entry dom_module_entry = { 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 @@ PHP_MINIT_FUNCTION(dom) 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; }