Skip to content

Commit

Permalink
initialize compress object in constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed Nov 6, 2013
1 parent e535c25 commit c0a0622
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions framework/Pack/lib/Horde/Pack.php
Expand Up @@ -63,6 +63,8 @@ public function __construct()
}

krsort(self::$_drivers, SORT_NUMERIC);

self::$_compress = new Horde_Compress_Fast();
}
}

Expand Down Expand Up @@ -130,7 +132,7 @@ public function pack($data, array $opts = array())
}

if ($compress) {
$packed = $this->_compressOb()->compress($packed);
$packed = self::$_compress->compress($packed);
$key |= self::COMPRESS_MASK;
}
}
Expand All @@ -157,7 +159,7 @@ public function unpack($data)
$data = substr($data, 1);

if ($mask & self::COMPRESS_MASK) {
$data = $this->_compressOb()->decompress($data);
$data = self::$_compress->decompress($data);
$mask ^= self::COMPRESS_MASK;
}

Expand All @@ -169,17 +171,4 @@ public function unpack($data)
throw new Horde_Pack_Exception('Could not unpack data.');
}

/* Internal methods. */

/**
*/
protected function _compressOb()
{
if (!isset(self::$_compress)) {
self::$_compress = new Horde_Compress_Fast();
}

return self::$_compress;
}

}

0 comments on commit c0a0622

Please sign in to comment.