summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandi <andi@splitbrain.org>2005-04-27 20:22:43 +0200
committerandi <andi@splitbrain.org>2005-04-27 20:22:43 +0200
commit2cd2db38e844b55a35cbbbf800835d6b84531308 (patch)
tree82fcb754fb1d3b303c24ffaedcc60d39160745f5
parent18509c28d451f8d207d58002f7881f522ae84977 (diff)
downloadrpg-2cd2db38e844b55a35cbbbf800835d6b84531308.tar.gz
rpg-2cd2db38e844b55a35cbbbf800835d6b84531308.tar.bz2
optimized count calls in for loops
darcs-hash:20050427182243-9977f-4c1ec6ce278925147379430540eec723d109444a.gz
-rw-r--r--inc/auth.php3
-rw-r--r--inc/parser/lexer.php3
-rw-r--r--inc/utf8.php6
3 files changed, 8 insertions, 4 deletions
diff --git a/inc/auth.php b/inc/auth.php
index 462a2c39f..4e3130ef7 100644
--- a/inc/auth.php
+++ b/inc/auth.php
@@ -222,7 +222,8 @@ function auth_aclcheck($id,$user,$groups){
if(!is_array($groups)) $groups = array();
//prepend groups with @
- for($i=0; $i<count($groups); $i++){
+ $cnt = count($groups);
+ for($i=0; $i<$cnt; $i++){
$groups[$i] = '@'.$groups[$i];
}
//if user is in superuser group return 255 (acl_admin)
diff --git a/inc/parser/lexer.php b/inc/parser/lexer.php
index b625ccacc..fb42ac27e 100644
--- a/inc/parser/lexer.php
+++ b/inc/parser/lexer.php
@@ -107,7 +107,8 @@ class Doku_LexerParallelRegex {
*/
function _getCompoundedRegex() {
if ($this->_regex == null) {
- for ($i = 0; $i < count($this->_patterns); $i++) {
+ $cnt = $this->_patterns;
+ for ($i = 0; $i < $cnt; $i++) {
// Replace lookaheads / lookbehinds with marker
$pattern = preg_replace(
diff --git a/inc/utf8.php b/inc/utf8.php
index 50a9556ee..3bc6b9a2d 100644
--- a/inc/utf8.php
+++ b/inc/utf8.php
@@ -225,7 +225,8 @@ function utf8_strtolower($string){
global $UTF8_UPPER_TO_LOWER;
$uni = utf8_to_unicode($string);
- for ($i=0; $i < count($uni); $i++){
+ $cnt = count($uni);
+ for ($i=0; $i < $cnt; $i++){
if($UTF8_UPPER_TO_LOWER[$uni[$i]]){
$uni[$i] = $UTF8_UPPER_TO_LOWER[$uni[$i]];
}
@@ -248,7 +249,8 @@ function utf8_strtoupper($string){
global $UTF8_LOWER_TO_UPPER;
$uni = utf8_to_unicode($string);
- for ($i=0; $i < count($uni); $i++){
+ $cnt = count($uni);
+ for ($i=0; $i < $cnt; $i++){
if($UTF8_LOWER_TO_UPPER[$uni[$i]]){
$uni[$i] = $UTF8_LOWER_TO_UPPER[$uni[$i]];
}