@@ -39,10 +39,6 @@ ZEND_DECLARE_MODULE_GLOBALS(ibm_db2)
39
39
40
40
#define ZEND_Z_STRVAL_PP (data ) Z_STRVAL_P(*data)
41
41
42
- #define ZEND_RETVAL_STRINGL (str , len , dup ) RETVAL_STRINGL(str, len)
43
-
44
- #define ZEND_RETVAL_STRING (str , val ) RETVAL_STRING(str)
45
-
46
42
#define ZEND_FETCH_RESOURCE_NEW (res , stmt_type , stmt , stmt_id , resource_type_name , le_stmt )\
47
43
res = (stmt_type) zend_fetch_resource(Z_RES_P(*stmt),resource_type_name,le_stmt);\
48
44
if(res == NULL)\
@@ -56,17 +52,11 @@ rsrc = (rsrc_type) zend_fetch_resource2(Z_RES_P(*passed_id),resource_type_name,r
56
52
if(rsrc == NULL)\
57
53
RETURN_FALSE;
58
54
59
- #define ZEND_RETURN_STRINGL (str ,len ,val ) RETURN_STRINGL(str, len)
60
-
61
- #define ZEND_RETURN_STRING_NOFREE (str ,val ) RETURN_STRING(str)
62
-
63
55
#define ZEND_RETURN_STRING (str ,val ) \
64
56
RETVAL_STRING(str); \
65
57
efree(str);\
66
58
return
67
59
68
- #define ZEND_STR (data ) Z_STR_P(data)
69
-
70
60
#define ZEND_ZVAL_PTR_DTOR (data ) zval_ptr_dtor(data)
71
61
72
62
#define IBM_DB2_ZEND_GET_TYPE (data ) (data)->u1.v.type
@@ -4694,7 +4684,7 @@ static int _php_db2_bind_pad(param_node *curr, int nullterm, int isvarying, int
4694
4684
* each string (or atom) is allocated once and never changed (immutable)
4695
4685
* aka, not useful for INOUT and OUT parameters obviously
4696
4686
*/
4697
- if (IS_INTERNED (ZEND_STR (* data ))) {
4687
+ if (IS_INTERNED (Z_STR_P (* data ))) {
4698
4688
/* Need use macro assignment to avoid leak in php 7. (Thanks Dimitry)
4699
4689
* Z_STR_P(*data) = zend_string_init(ZEND_Z_STRVAL_PP(data), ZEND_Z_STRLEN_PP(data), 0);
4700
4690
*/
@@ -5144,9 +5134,9 @@ static void _free_param_cache_list(stmt_handle *stmt_res) {
5144
5134
/* Free Values */
5145
5135
if (prev_ptr -> value != NULL ) {
5146
5136
if ( ZEND_Z_TYPE_P (prev_ptr -> value ) == IS_STRING ) {
5147
- if ((ZEND_STR (prev_ptr -> value )) != NULL || Z_STRLEN_P (prev_ptr -> value ) != 0 ) {
5148
- if (!IS_INTERNED ((ZEND_STR (prev_ptr -> value )))) {
5149
- zend_string_release ((ZEND_STR (prev_ptr -> value )));
5137
+ if ((Z_STR_P (prev_ptr -> value )) != NULL || Z_STRLEN_P (prev_ptr -> value ) != 0 ) {
5138
+ if (!IS_INTERNED ((Z_STR_P (prev_ptr -> value )))) {
5139
+ zend_string_release ((Z_STR_P (prev_ptr -> value )));
5150
5140
}
5151
5141
}
5152
5142
}
@@ -5412,7 +5402,7 @@ PHP_FUNCTION(db2_conn_errormsg)
5412
5402
5413
5403
ZEND_RETURN_STRING (return_str , 0 );
5414
5404
} else {
5415
- ZEND_RETURN_STRING_NOFREE (IBM_DB2_G (__php_conn_err_msg ), 1 );
5405
+ RETURN_STRING (IBM_DB2_G (__php_conn_err_msg ));
5416
5406
}
5417
5407
}
5418
5408
/* }}} */
@@ -5434,7 +5424,7 @@ PHP_FUNCTION(db2_stmt_errormsg)
5434
5424
if (stmt ) {
5435
5425
ZEND_FETCH_RESOURCE_NEW (stmt_res , stmt_handle * , & stmt , stmt_id , "Statement Resource" , le_stmt_struct );
5436
5426
if ( stmt_res -> exec_many_err_msg != NULL ) {
5437
- ZEND_RETURN_STRING_NOFREE (stmt_res -> exec_many_err_msg , 1 );
5427
+ RETURN_STRING (stmt_res -> exec_many_err_msg );
5438
5428
}
5439
5429
5440
5430
return_str = (char * )ecalloc (1 , DB2_MAX_ERR_MSG_LEN );
@@ -5445,7 +5435,7 @@ PHP_FUNCTION(db2_stmt_errormsg)
5445
5435
5446
5436
ZEND_RETURN_STRING (return_str , 0 );
5447
5437
} else {
5448
- ZEND_RETURN_STRING_NOFREE (IBM_DB2_G (__php_stmt_err_msg ), 1 );
5438
+ RETURN_STRING (IBM_DB2_G (__php_stmt_err_msg ));
5449
5439
}
5450
5440
}
5451
5441
/* }}} */
@@ -5478,7 +5468,7 @@ PHP_FUNCTION(db2_conn_error)
5478
5468
5479
5469
ZEND_RETURN_STRING (return_str , 0 );
5480
5470
} else {
5481
- ZEND_RETURN_STRING_NOFREE (IBM_DB2_G (__php_conn_err_state ), 1 );
5471
+ RETURN_STRING (IBM_DB2_G (__php_conn_err_state ));
5482
5472
}
5483
5473
}
5484
5474
/* }}} */
@@ -5511,7 +5501,7 @@ PHP_FUNCTION(db2_stmt_error)
5511
5501
5512
5502
ZEND_RETURN_STRING (return_str , 0 );
5513
5503
} else {
5514
- ZEND_RETURN_STRING_NOFREE (IBM_DB2_G (__php_stmt_err_state ), 1 );
5504
+ RETURN_STRING (IBM_DB2_G (__php_stmt_err_state ));
5515
5505
}
5516
5506
}
5517
5507
/* }}} */
@@ -5700,7 +5690,7 @@ PHP_FUNCTION(db2_field_name)
5700
5690
if ( col < 0 ) {
5701
5691
RETURN_FALSE ;
5702
5692
}
5703
- ZEND_RETURN_STRING_NOFREE ((char * )stmt_res -> column_info [col ].name , 1 );
5693
+ RETURN_STRING ((char * )stmt_res -> column_info [col ].name );
5704
5694
}
5705
5695
/* }}} */
5706
5696
@@ -5920,7 +5910,7 @@ PHP_FUNCTION(db2_field_type)
5920
5910
str_val = "string" ;
5921
5911
break ;
5922
5912
}
5923
- ZEND_RETURN_STRING_NOFREE (str_val , 1 );
5913
+ RETURN_STRING (str_val );
5924
5914
}
5925
5915
/* }}} */
5926
5916
@@ -6249,7 +6239,7 @@ PHP_FUNCTION(db2_result)
6249
6239
efree (out_ptr );
6250
6240
RETURN_NULL ();
6251
6241
} else {
6252
- ZEND_RETVAL_STRING ((char * )out_ptr , 1 );
6242
+ RETVAL_STRING ((char * )out_ptr );
6253
6243
efree (out_ptr );
6254
6244
}
6255
6245
break ;
@@ -6319,7 +6309,7 @@ PHP_FUNCTION(db2_result)
6319
6309
if (rc == SQL_ERROR ) {
6320
6310
RETURN_FALSE ;
6321
6311
}
6322
- ZEND_RETURN_STRINGL (out_char_ptr , out_length , 0 );
6312
+ RETURN_STRINGL (out_char_ptr , out_length );
6323
6313
break ;
6324
6314
case SQL_BLOB :
6325
6315
case SQL_BINARY :
@@ -6381,7 +6371,7 @@ PHP_FUNCTION(db2_result)
6381
6371
if (rc == SQL_ERROR ) {
6382
6372
RETURN_FALSE ;
6383
6373
}
6384
- ZEND_RETVAL_STRINGL ((char * )out_ptr ,out_length , 0 );
6374
+ RETVAL_STRINGL ((char * )out_ptr ,out_length );
6385
6375
default :
6386
6376
break ;
6387
6377
}
@@ -6413,7 +6403,7 @@ PHP_FUNCTION(db2_result)
6413
6403
if (out_length == SQL_NULL_DATA ) {
6414
6404
RETURN_NULL ();
6415
6405
}
6416
- ZEND_RETVAL_STRINGL ((char * )out_char_ptr ,out_length , 0 );
6406
+ RETVAL_STRINGL ((char * )out_char_ptr ,out_length );
6417
6407
#else /* not PASE */
6418
6408
rc = _php_db2_get_data (stmt_res , col_num + 1 , SQL_C_BINARY , NULL , 0 , (SQLINTEGER * )& in_length );
6419
6409
if ( rc == SQL_ERROR ) {
@@ -6431,7 +6421,7 @@ PHP_FUNCTION(db2_result)
6431
6421
if (rc == SQL_ERROR ) {
6432
6422
RETURN_FALSE ;
6433
6423
}
6434
- ZEND_RETVAL_STRINGL ((char * )out_ptr ,out_length , 0 );
6424
+ RETVAL_STRINGL ((char * )out_ptr ,out_length );
6435
6425
#endif /* not PASE */
6436
6426
break ;
6437
6427
@@ -7573,7 +7563,7 @@ PHP_FUNCTION(db2_escape_string)
7573
7563
/* reallocate to the real length */
7574
7564
new_str = (char * )realloc (new_str , new_length + 1 );
7575
7565
7576
- ZEND_RETURN_STRINGL (new_str , new_length , 1 );
7566
+ RETURN_STRINGL (new_str , new_length );
7577
7567
}
7578
7568
/* }}} */
7579
7569
@@ -7623,7 +7613,7 @@ PHP_FUNCTION(db2_lob_read)
7623
7613
RETURN_FALSE ;
7624
7614
}
7625
7615
7626
- ZEND_RETVAL_STRING ((char * )out_ptr , 1 );
7616
+ RETVAL_STRING ((char * )out_ptr );
7627
7617
efree (out_ptr );
7628
7618
}
7629
7619
/* }}} */
@@ -7710,7 +7700,7 @@ PHP_FUNCTION(db2_get_option)
7710
7700
php_error_docref (NULL , E_WARNING , "Incorrect option string passed in" );
7711
7701
RETURN_FALSE ;
7712
7702
}
7713
- ZEND_RETURN_STRINGL (value , val_len , 0 );
7703
+ RETURN_STRINGL (value , val_len );
7714
7704
} else {
7715
7705
php_error_docref (NULL , E_WARNING , "Supplied parameter is invalid" );
7716
7706
RETURN_FALSE ;
0 commit comments