summaryrefslogtreecommitdiff
path: root/inc/indexer.php
diff options
context:
space:
mode:
authorMichael Hamann <michael@content-space.de>2010-11-15 22:13:36 +0100
committerMichael Hamann <michael@content-space.de>2010-11-15 22:13:36 +0100
commit037b55733d384c194f7554c832f95a5e566c5884 (patch)
tree6720a2b1aaf581bbdf5fee686d29570c6fddc981 /inc/indexer.php
parent06af2d035180c4fb746a9b88c11178c516c88092 (diff)
downloadrpg-037b55733d384c194f7554c832f95a5e566c5884.tar.gz
rpg-037b55733d384c194f7554c832f95a5e566c5884.tar.bz2
Indexer improvement: replace _freadline by fgets
In PHP versions newer than 4.3.0 fgets reads a whole line regardless of its length when no length is given. Thus the loop in _freadline isn't needed. This increases the speed significantly as _freadline was called very often.
Diffstat (limited to 'inc/indexer.php')
-rw-r--r--inc/indexer.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/inc/indexer.php b/inc/indexer.php
index 0a7e2265e..a07c3b89a 100644
--- a/inc/indexer.php
+++ b/inc/indexer.php
@@ -149,7 +149,7 @@ function idx_saveIndexLine($pre, $wlen, $idx, $line){
$ih = @fopen($fn.'.idx','r');
if ($ih) {
$ln = -1;
- while (($curline = _freadline($ih)) !== false) {
+ while (($curline = fgets($ih)) !== false) {
if (++$ln == $idx) {
fwrite($fh, $line);
} else {
@@ -181,7 +181,7 @@ function idx_getIndexLine($pre, $wlen, $idx){
$fh = @fopen($fn,'r');
if(!$fh) return '';
$ln = -1;
- while (($line = _freadline($fh)) !== false) {
+ while (($line = fgets($fh)) !== false) {
if (++$ln == $idx) break;
}
fclose($fh);