@@ -425,17 +425,11 @@ ra_extract_key(RedisArray *ra, const char *key, int key_len, int *out_len TSRMLS
425425	char  * start , * end ;
426426	* out_len  =  key_len ;
427427
428- 	if (ra -> z_fun )
428+ 	if (ra -> z_fun ) { 
429429		return  ra_call_extractor (ra , key , key_len , out_len  TSRMLS_CC );
430- 
431- 	/* look for '{' */ 
432- 	start  =  strchr (key , '{' );
433- 	if (!start ) return  estrndup (key , key_len );
434- 
435- 	/* look for '}' */ 
436- 	end  =  strchr (start  +  1 , '}' );
437- 	if (!end ) return  estrndup (key , key_len );
438- 
430+     } else  if  ((start  =  strchr (key , '{' )) ==  NULL  ||  (end  =  strchr (start  +  1 , '}' )) ==  NULL ) {
431+         return  estrndup (key , key_len );
432+     }
439433	/* found substring */ 
440434	* out_len  =  end  -  start  -  1 ;
441435    return  estrndup (start  +  1 , * out_len );
@@ -768,17 +762,6 @@ ra_rehash_scan(zval *z_redis, char ***keys, int **key_lens, const char *cmd, con
768762	return  count ;
769763}
770764
771- static  long 
772- ra_rehash_scan_index (zval  * z_redis , char  * * * keys , int  * * key_lens  TSRMLS_DC ) {
773- 	return  ra_rehash_scan (z_redis , keys , key_lens , "SMEMBERS" , PHPREDIS_INDEX_NAME  TSRMLS_CC );
774- }
775- 
776- /* list keys using KEYS command */ 
777- static  long 
778- ra_rehash_scan_keys (zval  * z_redis , char  * * * keys , int  * * key_lens  TSRMLS_DC ) {
779- 	return  ra_rehash_scan (z_redis , keys , key_lens , "KEYS" , "*"  TSRMLS_CC );
780- }
781- 
782765/* run TYPE to find the type */ 
783766static  zend_bool 
784767ra_get_key_type (zval  * z_redis , const  char  * key , int  key_len , zval  * z_from , long  * res  TSRMLS_DC ) {
@@ -1254,9 +1237,9 @@ ra_rehash_server(RedisArray *ra, zval *z_redis, const char *hostname, zend_bool
12541237
12551238	/* list all keys */ 
12561239	if (b_index ) {
1257- 		count  =  ra_rehash_scan_index (z_redis , & keys , & key_lens  TSRMLS_CC );
1240+ 		count  =  ra_rehash_scan (z_redis , & keys , & key_lens ,  "SMEMBERS" ,  PHPREDIS_INDEX_NAME  TSRMLS_CC );
12581241	} else  {
1259- 		count  =  ra_rehash_scan_keys (z_redis , & keys , & key_lens  TSRMLS_CC );
1242+ 		count  =  ra_rehash_scan (z_redis , & keys , & key_lens ,  "KEYS" ,  "*"  TSRMLS_CC );
12601243	}
12611244
12621245	/* callback */ 
@@ -1274,12 +1257,11 @@ ra_rehash_server(RedisArray *ra, zval *z_redis, const char *hostname, zend_bool
12741257			/* php_printf("move [%s] from [%s] to [%s]\n", keys[i], hostname, ra->hosts[target_pos]); */ 
12751258			ra_move_key (keys [i ], key_lens [i ], z_redis , z_target  TSRMLS_CC );
12761259		}
1277- 	}
12781260
1279- 	/* cleanup */ 
1280- 	for (i  =  0 ; i  <  count ; ++ i ) {
1261+ 	    /* cleanup */ 
12811262		efree (keys [i ]);
12821263	}
1264+ 
12831265	efree (keys );
12841266	efree (key_lens );
12851267}
0 commit comments