Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Simplified looping code.

  • Loading branch information...
commit 8910199d3c7cbaef93ceefa2137de247ac44c83a 1 parent 21b4204
Derick Rethans authored October 19, 2012

Showing 1 changed file with 9 additions and 14 deletions. Show diff stats Hide diff stats

  1. 23  mongo.c
23  mongo.c
@@ -471,20 +471,15 @@ PHP_METHOD(Mongo, close)
471 471
 		if (Z_BVAL_P(hash)) {
472 472
 			/* Close all connections */
473 473
 			mongo_con_manager_item *ptr = link->manager->connections;
474  
-			mongo_con_manager_item *current = ptr;
475  
-			long count = 0;
476  
-
477  
-			do {
478  
-				if (current) {
479  
-					ptr = current;
480  
-					current = current->next;
481  
-					close_connection(link->manager, ptr->connection);
482  
-					count++;
483  
-				}
484  
-				else {
485  
-					break;
486  
-				}
487  
-			} while(1);
  474
+			mongo_con_manager_item *current;
  475
+			long                    count = 0;
  476
+
  477
+			while (ptr) {
  478
+				current = ptr;
  479
+				ptr = ptr->next;
  480
+				close_connection(link->manager, current->connection);
  481
+				count++;
  482
+			}
488 483
 
489 484
 			RETVAL_LONG(count);
490 485
 		} else {

0 notes on commit 8910199

Please sign in to comment.
Something went wrong with that request. Please try again.