37
37
38
38
ZEND_DECLARE_MODULE_GLOBALS (ibm_db2 )
39
39
40
- #define ZEND_Z_STRVAL_PP (data ) Z_STRVAL_P(*data)
41
-
42
40
#define ZEND_FETCH_RESOURCE_NEW (res , stmt_type , stmt , stmt_id , resource_type_name , le_stmt )\
43
41
res = (stmt_type ) zend_fetch_resource (Z_RES_P (* stmt ),resource_type_name ,le_stmt );\
44
42
if (res == NULL )\
@@ -57,17 +55,13 @@ RETVAL_STRING(str); \
57
55
efree(str);\
58
56
return
59
57
60
- #define ZEND_ZVAL_PTR_DTOR (data ) zval_ptr_dtor(data)
61
-
62
58
#define IBM_DB2_ZEND_GET_TYPE (data ) (data)->u1.v.type
63
59
#define RES_GET_TYPE (zval ) (zval)->type
64
60
65
61
#define ZEND_Z_TYPE_RESOURCE (newEntry ) RES_GET_TYPE(&newEntry)
66
62
67
63
#define ZEND_Z_TYPE (entry ) IBM_DB2_ZEND_GET_TYPE(&entry)
68
64
69
- #define ZEND_Z_STRLEN_PP (value ) Z_STRLEN_P(*value)
70
-
71
65
#define ZEND_Z_TYPE_P (entry ) IBM_DB2_ZEND_GET_TYPE(entry)
72
66
73
67
#define ZEND_Z_TYPE_PP (entry ) ZEND_Z_TYPE_P(*entry)
@@ -990,7 +984,7 @@ static void _php_db2_free_result_struct(stmt_handle* handle)
990
984
991
985
if ( prev_ptr -> param_type != DB2_PARAM_OUT && prev_ptr -> param_type != DB2_PARAM_INOUT ) {
992
986
if (prev_ptr -> value ) {
993
- ZEND_ZVAL_PTR_DTOR (prev_ptr -> value );
987
+ zval_ptr_dtor (prev_ptr -> value );
994
988
}
995
989
}
996
990
efree (prev_ptr );
@@ -1580,7 +1574,7 @@ static void _php_db2_assign_options( void *handle, int type, char *opt_key, zval
1580
1574
char * option_str = NULL ;
1581
1575
1582
1576
if (ZEND_Z_TYPE_PP (data ) == IS_STRING ) {
1583
- option_str = ZEND_Z_STRVAL_PP ( data );
1577
+ option_str = Z_STRVAL_P ( * data );
1584
1578
} else {
1585
1579
option_num = Z_LVAL_P (* data );
1586
1580
}
@@ -4637,7 +4631,7 @@ static int _php_db2_bind_pad(param_node *curr, int nullterm, int isvarying, int
4637
4631
platform_pad = 0x20 ;
4638
4632
}
4639
4633
/* IBM i has no CHAR0 type (zero length null term string) */
4640
- if (ZEND_Z_STRLEN_PP ( data ) == 0 || ZEND_Z_STRVAL_PP ( data )[0 ] == '\0' ) {
4634
+ if (Z_STRLEN_P ( * data ) == 0 || Z_STRVAL_P ( * data )[0 ] == '\0' ) {
4641
4635
switch (isvarying ) {
4642
4636
case 0 : /* need full *BLANKS */
4643
4637
platform_need_full_pad = 1 ;
@@ -4670,7 +4664,7 @@ static int _php_db2_bind_pad(param_node *curr, int nullterm, int isvarying, int
4670
4664
}
4671
4665
4672
4666
/* current length */
4673
- * poriglen = ZEND_Z_STRLEN_PP ( data );
4667
+ * poriglen = Z_STRLEN_P ( * data );
4674
4668
4675
4669
/*
4676
4670
* IS_INTERNED() macro to check if a given char* is interned or regular string
@@ -4679,9 +4673,9 @@ static int _php_db2_bind_pad(param_node *curr, int nullterm, int isvarying, int
4679
4673
*/
4680
4674
if (IS_INTERNED (Z_STR_P (* data ))) {
4681
4675
/* Need use macro assignment to avoid leak in php 7. (Thanks Dimitry)
4682
- * Z_STR_P(*data) = zend_string_init(ZEND_Z_STRVAL_PP( data), ZEND_Z_STRLEN_PP( data), 0);
4676
+ * Z_STR_P(*data) = zend_string_init(Z_STRVAL_P(* data), Z_STRLEN_P(* data), 0);
4683
4677
*/
4684
- ZVAL_STR (* data , zend_string_init (ZEND_Z_STRVAL_PP ( data ), ZEND_Z_STRLEN_PP ( data ), 0 ));
4678
+ ZVAL_STR (* data , zend_string_init (Z_STRVAL_P ( * data ), Z_STRLEN_P ( * data ), 0 ));
4685
4679
}
4686
4680
4687
4681
/* make enough space for full write */
@@ -4691,27 +4685,27 @@ static int _php_db2_bind_pad(param_node *curr, int nullterm, int isvarying, int
4691
4685
*/
4692
4686
ZVAL_STR (* data , zend_string_extend (Z_STR_P (* data ), curr -> param_size + nullterm , 0 ));
4693
4687
if (platform_need_full_pad ) {
4694
- memset (ZEND_Z_STRVAL_PP ( data ), platform_pad , curr -> param_size + nullterm );
4688
+ memset (Z_STRVAL_P ( * data ), platform_pad , curr -> param_size + nullterm );
4695
4689
} else {
4696
- memset (ZEND_Z_STRVAL_PP ( data ) + * poriglen , platform_pad , curr -> param_size - * poriglen );
4690
+ memset (Z_STRVAL_P ( * data ) + * poriglen , platform_pad , curr -> param_size - * poriglen );
4697
4691
}
4698
4692
#ifdef PASE /* i5/OS -- do not remove length-1, breaks IBM i. Also null orig len breaks IBM i. */
4699
4693
if (nullterm ) {
4700
- ZEND_Z_STRVAL_PP ( data )[curr -> param_size ] = '\0' ;
4694
+ Z_STRVAL_P ( * data )[curr -> param_size ] = '\0' ;
4701
4695
}
4702
- ZEND_Z_STRLEN_PP ( data ) = curr -> param_size ; /* yes, length-1 for bind parm max */
4696
+ Z_STRLEN_P ( * data ) = curr -> param_size ; /* yes, length-1 for bind parm max */
4703
4697
* poriglen = curr -> param_size ;
4704
4698
#else
4705
4699
if (nullterm ) {
4706
- ZEND_Z_STRVAL_PP ( data )[* poriglen ] = '\0' ;
4700
+ Z_STRVAL_P ( * data )[* poriglen ] = '\0' ;
4707
4701
}
4708
- ZEND_Z_STRLEN_PP ( data ) = curr -> param_size ; /* yes, length-1 for bind parm max */
4702
+ Z_STRLEN_P ( * data ) = curr -> param_size ; /* yes, length-1 for bind parm max */
4709
4703
#endif /* PASE */
4710
4704
}
4711
4705
4712
4706
/* IBM i has no CHAR0 type (return to normal) */
4713
4707
if (dreadPirateCHAR0 == 1 ) {
4714
- ZEND_Z_STRVAL_PP ( data )[0 ] = platform_pad ;
4708
+ Z_STRVAL_P ( * data )[0 ] = platform_pad ;
4715
4709
dreadPirateCHAR0 = 0 ;
4716
4710
curr -> param_type = save_param_type ;
4717
4711
switch (platform_need_full_pad ) {
@@ -4725,7 +4719,7 @@ static int _php_db2_bind_pad(param_node *curr, int nullterm, int isvarying, int
4725
4719
}
4726
4720
4727
4721
/* something went very wrong with heap */
4728
- if (ZEND_Z_STRVAL_PP ( data ) == NULL ) {
4722
+ if (Z_STRVAL_P ( * data ) == NULL ) {
4729
4723
return SQL_ERROR ;
4730
4724
}
4731
4725
@@ -4746,8 +4740,8 @@ static int _php_db2_bind_pad(param_node *curr, int nullterm, int isvarying, int
4746
4740
* '2' becomes '000000000000000000002'
4747
4741
*/
4748
4742
case SQL_BIGINT :
4749
- front = ZEND_Z_STRVAL_PP ( data );
4750
- here = back = ZEND_Z_STRVAL_PP ( data ) + ZEND_Z_STRLEN_PP ( data ) - nullterm ;
4743
+ front = Z_STRVAL_P ( * data );
4744
+ here = back = Z_STRVAL_P ( * data ) + Z_STRLEN_P ( * data ) - nullterm ;
4751
4745
for (;here >=front ;here -- ) {
4752
4746
if (* here == '-' ) {
4753
4747
isNeg = 1 ;
@@ -4803,7 +4797,7 @@ static int _php_db2_bind_data( stmt_handle *stmt_res, param_node *curr, zval **b
4803
4797
4804
4798
/* Clean old zval value and create a new one */
4805
4799
if ( curr -> value != 0 && curr -> param_type != DB2_PARAM_OUT && curr -> param_type != DB2_PARAM_INOUT )
4806
- ZEND_ZVAL_PTR_DTOR (curr -> value );
4800
+ zval_ptr_dtor (curr -> value );
4807
4801
if (!curr -> value ) {
4808
4802
curr -> value = (zval * )emalloc (sizeof (zval ));
4809
4803
}
@@ -4879,7 +4873,7 @@ static int _php_db2_bind_data( stmt_handle *stmt_res, param_node *curr, zval **b
4879
4873
if (ZEND_Z_TYPE_PP (bind_data ) == IS_NULL ){
4880
4874
break ;
4881
4875
}
4882
- /* make sure copy in is a string (ZEND_Z_STRVAL_PP( bind_data) && ) */
4876
+ /* make sure copy in is a string (Z_STRVAL_P(* bind_data) && ) */
4883
4877
if (* bind_data && ZEND_Z_TYPE_PP (bind_data ) != IS_STRING ) {
4884
4878
convert_to_string (* bind_data );
4885
4879
}
@@ -7088,7 +7082,7 @@ PHP_FUNCTION(db2_server_info)
7088
7082
7089
7083
add_property_zval (return_value , "KEYWORDS" , karray );
7090
7084
7091
- ZEND_ZVAL_PTR_DTOR (karray );
7085
+ zval_ptr_dtor (karray );
7092
7086
}
7093
7087
7094
7088
/* DFT_ISOLATION */
@@ -7159,7 +7153,7 @@ PHP_FUNCTION(db2_server_info)
7159
7153
7160
7154
add_property_zval (return_value , "ISOLATION_OPTION" , array );
7161
7155
7162
- ZEND_ZVAL_PTR_DTOR (array );
7156
+ zval_ptr_dtor (array );
7163
7157
}
7164
7158
7165
7159
/* SQL_CONFORMANCE */
0 commit comments