bjori Thu Jun 15 16:25:12 2006 UTC
Modified files:
/php-src/ext/dbase dbase.c
/php-src/ext/gd gd.c
/php-src/ext/curl interface.c
Log:
Add array type hinting
Remove unnecessary array checkes
http://cvs.php.net/viewcvs.cgi/php-src/ext/dbase/dbase.c?r1=1.80&r2=1.81&diff_format=u
Index: php-src/ext/dbase/dbase.c
diff -u php-src/ext/dbase/dbase.c:1.80 php-src/ext/dbase/dbase.c:1.81
--- php-src/ext/dbase/dbase.c:1.80 Thu Jun 15 15:31:39 2006
+++ php-src/ext/dbase/dbase.c Thu Jun 15 16:25:12 2006
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dbase.c,v 1.80 2006/06/15 15:31:39 bjori Exp $ */
+/* $Id: dbase.c,v 1.81 2006/06/15 16:25:12 bjori Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -261,10 +261,6 @@
WRONG_PARAM_COUNT;
}
convert_to_long_ex(dbh_id);
- if (Z_TYPE_PP(fields) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected array as
second parameter");
- RETURN_FALSE;
- }
dbh = zend_list_find(Z_LVAL_PP(dbh_id), &dbh_type);
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
@@ -332,10 +328,6 @@
}
convert_to_long_ex(dbh_id);
convert_to_long_ex(recnum);
- if (Z_TYPE_PP(fields) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected array as
second parameter");
- RETURN_FALSE;
- }
dbh = zend_list_find(Z_LVAL_PP(dbh_id), &dbh_type);
if (!dbh || dbh_type != DBase_GLOBAL(le_dbhead)) {
@@ -581,11 +573,6 @@
}
convert_to_string_ex(filename);
- if (Z_TYPE_PP(fields) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected array as
second parameter");
- RETURN_FALSE;
- }
-
if (php_check_open_basedir(Z_STRVAL_PP(filename) TSRMLS_CC)) {
RETURN_FALSE;
}
@@ -638,12 +625,6 @@
RETURN_FALSE;
}
- if (Z_TYPE_PP (field) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "second
parameter must be array of arrays");
- free_dbf_head(dbh);
- RETURN_FALSE;
- }
-
/* field name */
if (zend_hash_index_find(Z_ARRVAL_PP(field), 0, (void
**)&value) == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "expected
field name as first element of list in field %d", i);
@@ -749,13 +730,13 @@
static
ZEND_BEGIN_ARG_INFO(arginfo_dbase_add_record, 0)
ZEND_ARG_INFO(0, identifier)
- ZEND_ARG_INFO(0, data) /* ARRAY_INFO(0, data, 0) */
+ ZEND_ARG_ARRAY_INFO(0, data, 0)
ZEND_END_ARG_INFO()
static
ZEND_BEGIN_ARG_INFO(arginfo_dbase_replace_record, 0)
ZEND_ARG_INFO(0, identifier)
- ZEND_ARG_INFO(0, data) /* ARRAY_INFO(0, data, 0) */
+ ZEND_ARG_ARRAY_INFO(0, data, 0)
ZEND_ARG_INFO(0, recnum)
ZEND_END_ARG_INFO()
@@ -780,7 +761,7 @@
static
ZEND_BEGIN_ARG_INFO(arginfo_dbase_create, 0)
ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, fields) /* ARRAY_INFO(0, fields, 0) */
+ ZEND_ARG_ARRAY_INFO(0, fields, 0)
ZEND_END_ARG_INFO()
static
http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/gd.c?r1=1.351&r2=1.352&diff_format=u
Index: php-src/ext/gd/gd.c
diff -u php-src/ext/gd/gd.c:1.351 php-src/ext/gd/gd.c:1.352
--- php-src/ext/gd/gd.c:1.351 Thu Jun 15 15:31:39 2006
+++ php-src/ext/gd/gd.c Thu Jun 15 16:25:12 2006
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: gd.c,v 1.351 2006/06/15 15:31:39 bjori Exp $ */
+/* $Id: gd.c,v 1.352 2006/06/15 16:25:12 bjori Exp $ */
/* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
Cold Spring Harbor Labs. */
@@ -148,7 +148,7 @@
static
ZEND_BEGIN_ARG_INFO(arginfo_imagesetstyle, 0)
ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, styles) /* ARRAY_INFO(0, styles, 0) */
+ ZEND_ARG_ARRAY_INFO(0, styles, 0)
ZEND_END_ARG_INFO()
static
@@ -627,7 +627,7 @@
static
ZEND_BEGIN_ARG_INFO(arginfo_imagepolygon, 0)
ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, points) /* ARRAY_INFO(0, points, 0) */
+ ZEND_ARG_ARRAY_INFO(0, points, 0)
ZEND_ARG_INFO(0, num_pos)
ZEND_ARG_INFO(0, col)
ZEND_END_ARG_INFO()
@@ -635,7 +635,7 @@
static
ZEND_BEGIN_ARG_INFO(arginfo_imagefilledpolygon, 0)
ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, points) /* ARRAY_INFO(0, points, 0) */
+ ZEND_ARG_ARRAY_INFO(0, points, 0)
ZEND_ARG_INFO(0, num_pos)
ZEND_ARG_INFO(0, col)
ZEND_END_ARG_INFO()
@@ -760,7 +760,7 @@
ZEND_ARG_INFO(0, float angle)
ZEND_ARG_INFO(0, font_file)
ZEND_ARG_INFO(0, text)
- ZEND_ARG_INFO(0, extrainfo) /* ARRAY_INFO(0, extrainfo, 0) */
+ ZEND_ARG_ARRAY_INFO(0, extrainfo, 0)
ZEND_END_ARG_INFO()
static
@@ -773,7 +773,7 @@
ZEND_ARG_INFO(0, col)
ZEND_ARG_INFO(0, font_file)
ZEND_ARG_INFO(0, text)
- ZEND_ARG_INFO(0, extrainfo) /* ARRAY_INFO(0, extrainfo, 0) */
+ ZEND_ARG_ARRAY_INFO(0, extrainfo, 0)
ZEND_END_ARG_INFO()
#endif
@@ -903,7 +903,7 @@
static
ZEND_BEGIN_ARG_INFO(arginfo_imageconvolution, 0)
ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, matrix3x3) /* ARRAY_INFO(0, matrix3x3, 0) */
+ ZEND_ARG_ARRAY_INFO(0, matrix3x3, 0)
ZEND_ARG_INFO(0, div)
ZEND_ARG_INFO(0, offset)
ZEND_END_ARG_INFO()
@@ -3226,11 +3226,6 @@
npoints = Z_LVAL_PP(NPOINTS);
col = Z_LVAL_PP(COL);
- if (Z_TYPE_PP(POINTS) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "2nd argument to
imagepolygon not an array");
- RETURN_FALSE;
- }
-
nelem = zend_hash_num_elements(Z_ARRVAL_PP(POINTS));
if (nelem < 6) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must have at
least 3 points in your array");
@@ -4796,7 +4791,7 @@
for (i=0; i<3; i++) {
if (zend_hash_index_find(Z_ARRVAL_P(hash_matrix), (i), (void
**) &var) == SUCCESS) {
- if (Z_TYPE_PP(var) != IS_ARRAY ||
zend_hash_num_elements(Z_ARRVAL_PP(var)) != 3 ) {
+ if (zend_hash_num_elements(Z_ARRVAL_PP(var)) != 3 ) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,
"You must have 3x3 array");
RETURN_FALSE;
}
http://cvs.php.net/viewcvs.cgi/php-src/ext/curl/interface.c?r1=1.82&r2=1.83&diff_format=u
Index: php-src/ext/curl/interface.c
diff -u php-src/ext/curl/interface.c:1.82 php-src/ext/curl/interface.c:1.83
--- php-src/ext/curl/interface.c:1.82 Thu Jun 15 15:31:39 2006
+++ php-src/ext/curl/interface.c Thu Jun 15 16:25:12 2006
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: interface.c,v 1.82 2006/06/15 15:31:39 bjori Exp $ */
+/* $Id: interface.c,v 1.83 2006/06/15 16:25:12 bjori Exp $ */
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
@@ -205,7 +205,7 @@
static
ZEND_BEGIN_ARG_INFO(arginfo_curl_setopt_array, 0)
ZEND_ARG_INFO(0, ch)
- ZEND_ARG_INFO(0, options)/* ARRAY_INFO(0, options, 0) */
+ ZEND_ARG_ARRAY_INFO(0, options, 0)
ZEND_END_ARG_INFO()
static
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php