Preincrement is faster
Preincrement is faster

--- a/include/display.git_log.php
+++ b/include/display.git_log.php
@@ -45,7 +45,7 @@
 
 		$commitlines = array();
 		$commitcount = min(100,$revlistcount);
-		for ($i = 0; $i < $commitcount; $i++) {
+		for ($i = 0; $i < $commitcount; ++$i) {
 			$commit = $revlist[$i];
 			if (isset($commit) && strlen($commit) > 1) {
 				$commitline = array();

--- a/include/display.git_rss.php
+++ b/include/display.git_rss.php
@@ -29,7 +29,7 @@
 
 		$commitlines = array();
 		$revlistcount = count($revlist);
-		for ($i = 0; $i < $revlistcount; $i++) {
+		for ($i = 0; $i < $revlistcount; ++$i) {
 			$commit = $revlist[$i];
 			$co = git_read_commit($projectroot . $project, $commit);
 			if (($i >= 20) && ((time() - $co['committer_epoch']) > 48*60*60))

--- a/include/display.git_search.php
+++ b/include/display.git_search.php
@@ -56,7 +56,7 @@
 
 		$commitlines = array();
 		$commitcount = min(100,$revlistcount);
-		for ($i = 0; $i < $commitcount; $i++) {
+		for ($i = 0; $i < $commitcount; ++$i) {
 			$commit = $revlist[$i];
 			if (strlen(trim($commit)) > 0) {
 				$commitline = array();

--- a/include/display.git_search_files.php
+++ b/include/display.git_search_files.php
@@ -88,7 +88,7 @@
 					$filesearchline["matches"] = $matches;
 			}
 			$filesearchlines[] = $filesearchline;
-			$i++;
+			++$i;
 			if ($i >= 100)
 				break;
 		}

--- a/include/display.git_shortlog.php
+++ b/include/display.git_shortlog.php
@@ -39,7 +39,7 @@
 
 		$commitlines = array();
 		$commitcount = min(100,count($revlist));
-		for ($i = 0; $i < $commitcount; $i++) {
+		for ($i = 0; $i < $commitcount; ++$i) {
 			$commit = $revlist[$i];
 			if (strlen(trim($commit)) > 0) {
 				$commitline = array();

--- a/include/gitutil.git_filesearch.php
+++ b/include/gitutil.git_filesearch.php
@@ -73,7 +73,7 @@
 		foreach ($matches as $i => $val) {
 			if ($index > $count)
 				unset($matches[$i]);
-			$index++;
+			++$index;
 		}
 	}
 

--- a/include/gitutil.git_read_projects.php
+++ b/include/gitutil.git_read_projects.php
@@ -37,7 +37,7 @@
 				$projects = git_recurse_projects($projectroot);
 				$len = count($projects);
 				$cut = strlen($projectroot);
-				for ($i = 0; $i < $len; $i++) {
+				for ($i = 0; $i < $len; ++$i) {
 					$p = substr($projects[$i],$cut + 1);
 					if ($projdata)
 						$projects[$i] = git_project_info($projectroot, $p);

--- a/include/gitutil.git_read_revlist.php
+++ b/include/gitutil.git_read_revlist.php
@@ -36,7 +36,7 @@
 	if ((!$canskip) && ($skip > 0)) {
 		$tmp = array();
 		$revcount = count($revlist);
-		for ($i = $skip; $i < $revcount; $i++)
+		for ($i = $skip; $i < $revcount; ++$i)
 			$tmp[] = $revlist[$i];
 		return $tmp;
 	}

comments