Port _php_handle_cliprect_array function.

Piotr Pawłow [2016-09-23 00:43:00]
Port _php_handle_cliprect_array function.
Filename
php_imlib.c
diff --git a/php_imlib.c b/php_imlib.c
index c1164a3..84f6a9a 100644
--- a/php_imlib.c
+++ b/php_imlib.c
@@ -831,7 +831,7 @@ PHP_MINFO_FUNCTION(imlib)
 static int _php_handle_cliprect_array(zval **dbox, char *func_name,
                                       int *x, int *y, int *w, int *h TSRMLS_DC)
 {
-   zval **element, ***box_coords;
+   zval *element, **box_coords;
    int i,arrcount;
    HashTable *box;

@@ -848,20 +848,20 @@ static int _php_handle_cliprect_array(zval **dbox, char *func_name,
       return 0;
    }

-   box_coords = (zval ***)emalloc(arrcount * sizeof(zval **));
+   box_coords = (zval **)emalloc(arrcount * sizeof(zval *));

    for (i = 0; i < arrcount; i++)
    {
-      if (zend_hash_index_find(box, i, (void **)&element) == SUCCESS)
+      if (element = zend_hash_index_find(box, i))
       {
          convert_to_long_ex(element);
          box_coords[i] = element;
       }
    }
-   *x = Z_LVAL_PP(box_coords[0]);
-   *y = Z_LVAL_PP(box_coords[1]);
-   *w = Z_LVAL_PP(box_coords[2]);
-   *h = Z_LVAL_PP(box_coords[3]);
+   *x = Z_LVAL_P(box_coords[0]);
+   *y = Z_LVAL_P(box_coords[1]);
+   *w = Z_LVAL_P(box_coords[2]);
+   *h = Z_LVAL_P(box_coords[3]);

    efree(box_coords);
    return 1;
ViewGit