@@ -154,7 +154,6 @@ pid_gen(struct tarantool_url *url, const char *user, const char *prefix,
154154 const char * suffix , size_t suffix_len , size_t * olen ) {
155155
156156 char * plist_id = NULL , * tmp = NULL ;
157- /* if user is not defined, then user is 'guest' */
158157 int len = 0 ;
159158 if (url -> type == TARANTOOL_URL_TCP ) {
160159 len = spprintf (& plist_id , 0 , "tarantool-%s:id=%s:%d-%s" ,
@@ -265,8 +264,8 @@ static int __tarantool_connect(tarantool_object *t_obj) {
265264 continue ;
266265 if (tntll_stream_read2 (obj -> stream , obj -> greeting ,
267266 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 ));
270269 continue ;
271270 }
272271 if (php_tp_verify_greetings (obj -> greeting ) == 0 ) {
@@ -278,7 +277,7 @@ static int __tarantool_connect(tarantool_object *t_obj) {
278277 }
279278 if (count == 0 ) {
280279ioexception :
281- tarantool_throw_ioexception ("%s " , err );
280+ tarantool_throw_ioexception ("%s" , err );
282281 efree (err );
283282 return FAILURE ;
284283 }
@@ -294,7 +293,7 @@ inline static int __tarantool_reconnect(tarantool_object *t_obj) {
294293 return __tarantool_connect (t_obj );
295294}
296295
297- static void
296+ static void
298297tarantool_connection_free (tarantool_connection * obj , int is_persistent
299298 TSRMLS_DC ) {
300299 if (obj == NULL )
@@ -303,7 +302,7 @@ tarantool_connection_free(tarantool_connection *obj, int is_persistent
303302 pefree (obj -> greeting , is_persistent );
304303 obj -> greeting = NULL ;
305304 }
306- // tarantool_stream_close(obj);
305+ tarantool_stream_close (obj );
307306 if (obj -> persistent_id ) {
308307 zend_string_release (obj -> persistent_id );
309308 obj -> persistent_id = NULL ;
@@ -626,10 +625,11 @@ int obtain_space_by_spaceno(tarantool_connection *obj, uint32_t space_no) {
626625 size_t body_size = php_mp_unpack_package_size (pack_len );
627626 smart_string_ensure (obj -> value , body_size );
628627 if (tarantool_stream_read (obj , obj -> value -> c ,
629- body_size ) == FAILURE )
628+ body_size ) == FAILURE )
630629 return FAILURE ;
631630
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 ));
633633 if (php_tp_response (& resp , obj -> value -> c , body_size ) == -1 ) {
634634 tarantool_throw_parsingexception ("query" );
635635 return FAILURE ;
@@ -682,10 +682,11 @@ int get_spaceno_by_name(tarantool_connection *obj, zval *name) {
682682 size_t body_size = php_mp_unpack_package_size (pack_len );
683683 smart_string_ensure (obj -> value , body_size );
684684 if (tarantool_stream_read (obj , obj -> value -> c ,
685- body_size ) == FAILURE )
685+ body_size ) == FAILURE )
686686 return FAILURE ;
687687
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 ));
689690 if (php_tp_response (& resp , obj -> value -> c , body_size ) == -1 ) {
690691 tarantool_throw_parsingexception ("query" );
691692 return FAILURE ;
@@ -749,7 +750,8 @@ int get_indexno_by_name(tarantool_connection *obj, int space_no,
749750 if (tarantool_stream_read (obj , obj -> value -> c , body_size ) == FAILURE )
750751 return FAILURE ;
751752
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 ));
753755 if (php_tp_response (& resp , obj -> value -> c , body_size ) == -1 ) {
754756 tarantool_throw_parsingexception ("query" );
755757 return FAILURE ;
@@ -804,7 +806,8 @@ int get_fieldno_by_name(tarantool_connection *obj, uint32_t space_no,
804806 if (tarantool_stream_read (obj , obj -> value -> c , body_size ) == FAILURE )
805807 return FAILURE ;
806808
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 ));
808811 if (php_tp_response (& resp , obj -> value -> c , body_size ) == -1 ) {
809812 tarantool_throw_parsingexception ("query" );
810813 return FAILURE ;
@@ -1119,9 +1122,9 @@ PHP_METHOD(Tarantool, __construct) {
11191122 suffix_or_port = & suffix_or_port_default ;
11201123 }
11211124
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 ||
11251128 Z_TYPE_P (suffix_or_port ) == IS_STRING ) {
11261129 url = estrdup (host );
11271130 url_len = host_len ;
@@ -1173,34 +1176,6 @@ PHP_METHOD(Tarantool, __construct) {
11731176 if (url_parsed == NULL ) {
11741177 THROW_EXC ("failed to parse url: '%s'" , url );
11751178 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- } */
12041179 }
12051180 efree (url );
12061181
@@ -1212,7 +1187,7 @@ PHP_METHOD(Tarantool, __construct) {
12121187
12131188 le = zend_hash_find_ptr (& EG (persistent_list ), plist_id );
12141189 if (le != NULL ) {
1215- /* It's likely § */
1190+ /* It's likely */
12161191 if (le -> type == php_tarantool_list_entry ()) {
12171192 obj = (tarantool_connection * ) le -> ptr ;
12181193 plist_new_entry = false;
@@ -1245,7 +1220,6 @@ PHP_METHOD(Tarantool, __construct) {
12451220 char * url_s = pestrdup (obj -> url , is_persistent );
12461221 efree (obj -> url );
12471222 obj -> url = url_s ;
1248- /* If pass == NULL, then authenticate without password */
12491223 if (is_persistent ) {
12501224 obj -> persistent_id = pid_pzsgen (obj -> url_parsed ,
12511225 obj -> url_parsed -> user ,
0 commit comments