@@ -154,7 +154,6 @@ pid_gen(struct tarantool_url *url, const char *user, const char *prefix,
154
154
const char * suffix , size_t suffix_len , size_t * olen ) {
155
155
156
156
char * plist_id = NULL , * tmp = NULL ;
157
- /* if user is not defined, then user is 'guest' */
158
157
int len = 0 ;
159
158
if (url -> type == TARANTOOL_URL_TCP ) {
160
159
len = spprintf (& plist_id , 0 , "tarantool-%s:id=%s:%d-%s" ,
@@ -265,8 +264,8 @@ static int __tarantool_connect(tarantool_object *t_obj) {
265
264
continue ;
266
265
if (tntll_stream_read2 (obj -> stream , obj -> greeting ,
267
266
GREETING_SIZE ) != GREETING_SIZE ) {
268
- // int errno = php_stream_errno();
269
- spprintf ( & err , 0 , "Fails to read greeting [%d]: %s" , errno , strerror (errno ));
267
+ spprintf ( & err , 0 , "Fails to read greeting [%d]: %s" ,
268
+ errno , strerror (errno ));
270
269
continue ;
271
270
}
272
271
if (php_tp_verify_greetings (obj -> greeting ) == 0 ) {
@@ -278,7 +277,7 @@ static int __tarantool_connect(tarantool_object *t_obj) {
278
277
}
279
278
if (count == 0 ) {
280
279
ioexception :
281
- tarantool_throw_ioexception ("%s " , err );
280
+ tarantool_throw_ioexception ("%s" , err );
282
281
efree (err );
283
282
return FAILURE ;
284
283
}
@@ -294,7 +293,7 @@ inline static int __tarantool_reconnect(tarantool_object *t_obj) {
294
293
return __tarantool_connect (t_obj );
295
294
}
296
295
297
- static void
296
+ static void
298
297
tarantool_connection_free (tarantool_connection * obj , int is_persistent
299
298
TSRMLS_DC ) {
300
299
if (obj == NULL )
@@ -303,7 +302,7 @@ tarantool_connection_free(tarantool_connection *obj, int is_persistent
303
302
pefree (obj -> greeting , is_persistent );
304
303
obj -> greeting = NULL ;
305
304
}
306
- // tarantool_stream_close(obj);
305
+ tarantool_stream_close (obj );
307
306
if (obj -> persistent_id ) {
308
307
zend_string_release (obj -> persistent_id );
309
308
obj -> persistent_id = NULL ;
@@ -626,10 +625,11 @@ int obtain_space_by_spaceno(tarantool_connection *obj, uint32_t space_no) {
626
625
size_t body_size = php_mp_unpack_package_size (pack_len );
627
626
smart_string_ensure (obj -> value , body_size );
628
627
if (tarantool_stream_read (obj , obj -> value -> c ,
629
- body_size ) == FAILURE )
628
+ body_size ) == FAILURE )
630
629
return FAILURE ;
631
630
632
- struct tnt_response resp ; memset (& resp , 0 , sizeof (struct tnt_response ));
631
+ struct tnt_response resp ;
632
+ memset (& resp , 0 , sizeof (struct tnt_response ));
633
633
if (php_tp_response (& resp , obj -> value -> c , body_size ) == -1 ) {
634
634
tarantool_throw_parsingexception ("query" );
635
635
return FAILURE ;
@@ -682,10 +682,11 @@ int get_spaceno_by_name(tarantool_connection *obj, zval *name) {
682
682
size_t body_size = php_mp_unpack_package_size (pack_len );
683
683
smart_string_ensure (obj -> value , body_size );
684
684
if (tarantool_stream_read (obj , obj -> value -> c ,
685
- body_size ) == FAILURE )
685
+ body_size ) == FAILURE )
686
686
return FAILURE ;
687
687
688
- struct tnt_response resp ; memset (& resp , 0 , sizeof (struct tnt_response ));
688
+ struct tnt_response resp ;
689
+ memset (& resp , 0 , sizeof (struct tnt_response ));
689
690
if (php_tp_response (& resp , obj -> value -> c , body_size ) == -1 ) {
690
691
tarantool_throw_parsingexception ("query" );
691
692
return FAILURE ;
@@ -749,7 +750,8 @@ int get_indexno_by_name(tarantool_connection *obj, int space_no,
749
750
if (tarantool_stream_read (obj , obj -> value -> c , body_size ) == FAILURE )
750
751
return FAILURE ;
751
752
752
- struct tnt_response resp ; memset (& resp , 0 , sizeof (struct tnt_response ));
753
+ struct tnt_response resp ;
754
+ memset (& resp , 0 , sizeof (struct tnt_response ));
753
755
if (php_tp_response (& resp , obj -> value -> c , body_size ) == -1 ) {
754
756
tarantool_throw_parsingexception ("query" );
755
757
return FAILURE ;
@@ -804,7 +806,8 @@ int get_fieldno_by_name(tarantool_connection *obj, uint32_t space_no,
804
806
if (tarantool_stream_read (obj , obj -> value -> c , body_size ) == FAILURE )
805
807
return FAILURE ;
806
808
807
- struct tnt_response resp ; memset (& resp , 0 , sizeof (struct tnt_response ));
809
+ struct tnt_response resp ;
810
+ memset (& resp , 0 , sizeof (struct tnt_response ));
808
811
if (php_tp_response (& resp , obj -> value -> c , body_size ) == -1 ) {
809
812
tarantool_throw_parsingexception ("query" );
810
813
return FAILURE ;
@@ -1119,9 +1122,9 @@ PHP_METHOD(Tarantool, __construct) {
1119
1122
suffix_or_port = & suffix_or_port_default ;
1120
1123
}
1121
1124
1122
- if (strstr (host , "tcp://" ) != 0 ||
1123
- strstr (host , "unix://" ) != 0 ||
1124
- strstr (host , "unix/:" ) != 0 ||
1125
+ if (strstr (host , "tcp://" ) != NULL ||
1126
+ strstr (host , "unix://" ) != NULL ||
1127
+ strstr (host , "unix/:" ) != NULL ||
1125
1128
Z_TYPE_P (suffix_or_port ) == IS_STRING ) {
1126
1129
url = estrdup (host );
1127
1130
url_len = host_len ;
@@ -1173,34 +1176,6 @@ PHP_METHOD(Tarantool, __construct) {
1173
1176
if (url_parsed == NULL ) {
1174
1177
THROW_EXC ("failed to parse url: '%s'" , url );
1175
1178
RETURN_FALSE ;
1176
- } else {
1177
- /* set default user
1178
- if (url_parsed->user == NULL) {
1179
- url_parsed->user = estrdup("guest");
1180
- } */
1181
- /* set default password
1182
- if (url_parsed->pass && strlen(url_parsed->pass) == 0) {
1183
- efree(url_parsed->pass);
1184
- url_parsed->pass = NULL;
1185
- } */
1186
- /* try to deduct scheme (based on host/path presence)
1187
- if (url_parsed->scheme == NULL) {
1188
- if (url_parsed->host != NULL) {
1189
- url_parsed->scheme = estrdup("tcp");
1190
- } else if (url_parsed->path != NULL) {
1191
- url_parsed->scheme = estrdup("unix");
1192
- } else {
1193
- THROW_EXC("Unknown url: %s", url);
1194
- RETURN_FALSE;
1195
- }
1196
- } */
1197
- /* check that protocik is supported
1198
- if (strcmp(url_parsed->scheme, "tcp") != 0 &&
1199
- strcmp(url_parsed->scheme, "unix") != 0) {
1200
- THROW_EXC("Unsupported protocol: %s",
1201
- url_parsed->scheme);
1202
- RETURN_FALSE;
1203
- } */
1204
1179
}
1205
1180
efree (url );
1206
1181
@@ -1212,7 +1187,7 @@ PHP_METHOD(Tarantool, __construct) {
1212
1187
1213
1188
le = zend_hash_find_ptr (& EG (persistent_list ), plist_id );
1214
1189
if (le != NULL ) {
1215
- /* It's likely § */
1190
+ /* It's likely */
1216
1191
if (le -> type == php_tarantool_list_entry ()) {
1217
1192
obj = (tarantool_connection * ) le -> ptr ;
1218
1193
plist_new_entry = false;
@@ -1245,7 +1220,6 @@ PHP_METHOD(Tarantool, __construct) {
1245
1220
char * url_s = pestrdup (obj -> url , is_persistent );
1246
1221
efree (obj -> url );
1247
1222
obj -> url = url_s ;
1248
- /* If pass == NULL, then authenticate without password */
1249
1223
if (is_persistent ) {
1250
1224
obj -> persistent_id = pid_pzsgen (obj -> url_parsed ,
1251
1225
obj -> url_parsed -> user ,
0 commit comments