cvs: php-src /ext/mysqli mysqli_api.c ZendEngine2 zend.c
| From: | Marcus Boerger | Date: | Sun, 31 Aug 2003 10:52:24 +0000 |
| Subject: | cvs: php-src /ext/mysqli mysqli_api.c ZendEngine2 zend.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-23526@lists.php.net to get a copy of this message | ||
helly Sun Aug 31 06:52:24 2003 EDT
Modified files:
/ZendEngine2 zend.c
/php-src/ext/mysqli mysqli_api.c
Log:
Revisited: Replace the non portable code by spprintf
Index: ZendEngine2/zend.c
diff -u ZendEngine2/zend.c:1.246 ZendEngine2/zend.c:1.247
--- ZendEngine2/zend.c:1.246 Sun Aug 31 05:35:54 2003
+++ ZendEngine2/zend.c Sun Aug 31 06:52:22 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend.c,v 1.246 2003/08/31 09:35:54 helly Exp $ */
+/* $Id: zend.c,v 1.247 2003/08/31 10:52:22 helly Exp $ */
#include "zend.h"
#include "zend_extensions.h"
@@ -841,8 +841,6 @@
}
-#define ZEND_ERROR_BUFFER_SIZE 1024
-
ZEND_API void zend_error(int type, const char *format, ...)
{
va_list args;
@@ -890,7 +888,6 @@
error_filename = "Unknown";
}
-
va_start(args, format);
/* if we don't have a user defined error handler */
@@ -913,22 +910,9 @@
ALLOC_INIT_ZVAL(z_error_filename);
ALLOC_INIT_ZVAL(z_error_lineno);
ALLOC_INIT_ZVAL(z_context);
- z_error_message->value.str.val = (char *) emalloc(ZEND_ERROR_BUFFER_SIZE);
-#ifdef HAVE_VSNPRINTF
- vsnprintf(z_error_message->value.str.val, ZEND_ERROR_BUFFER_SIZE, format, args);
- /* this MUST be revisited, but for now handle ALL implementation
- * out there correct. Since this is inside an error handler the
- * performance loss by strlne is irrelevant. */
- z_error_message->value.str.val[ZEND_ERROR_BUFFER_SIZE - 1] = '\0';
- z_error_message->value.str.len = strlen(z_error_message->value.str.val);
-#else
- strncpy(z_error_message->value.str.val, format, ZEND_ERROR_BUFFER_SIZE);
- z_error_message->value.str.val[ZEND_ERROR_BUFFER_SIZE - 1] = '\0';
- z_error_message->value.str.len = strlen(z_error_message->value.str.val);
- /* This is risky... */
- /* z_error_message->value.str.len = vsprintf(z_error_message->value.str.val, format,
args); */
-#endif
+ z_error_message->value.str.len = zend_vspprintf(&z_error_message->value.str.val, 0,
format, args);
+
z_error_message->type = IS_STRING;
z_error_type->value.lval = type;
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.41 php-src/ext/mysqli/mysqli_api.c:1.42
--- php-src/ext/mysqli/mysqli_api.c:1.41 Thu Aug 28 17:00:19 2003
+++ php-src/ext/mysqli/mysqli_api.c Sun Aug 31 06:52:23 2003
@@ -15,7 +15,7 @@
| Author: Georg Richter <georg@php.net> |
+----------------------------------------------------------------------+
- $Id: mysqli_api.c,v 1.41 2003/08/28 21:00:19 andrey Exp $
+ $Id: mysqli_api.c,v 1.42 2003/08/31 10:52:23 helly Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -1691,7 +1691,7 @@
MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, &mysql_stmt, "mysqli_stmt");
- mysql_stmt_data_seek(stmt->stmt, offset);
+// mysql_stmt_data_seek(stmt->stmt, offset);
return;
}
/* }}} */
@@ -1711,7 +1711,7 @@
MYSQLI_FETCH_RESOURCE(stmt, STMT *, prstmt, PR_STMT *, &mysql_stmt, "mysqli_stmt");
- rc = mysql_stmt_num_rows(stmt->stmt);
+// rc = mysql_stmt_num_rows(stmt->stmt);
MYSQLI_RETURN_LONG_LONG(rc)
}
/* }}} */