THRIFT-1521:patches for more Performance

Client: php
Patch: D. Edler

Removes double function calls in the transport classes to strlen.



git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1390051 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jake Farrell 2012-09-25 18:58:27 +00:00
parent 41dfe6fd5e
commit 78a54a17f1

View File

@ -59,13 +59,15 @@ class TMemoryBuffer extends TTransport {
}
public function read($len) {
if (TStringFuncFactory::create()->strlen($this->buf_) === 0) {
$bufLength = TStringFuncFactory::create()->strlen($this->buf_);
if ($bufLength === 0) {
throw new TTransportException('TMemoryBuffer: Could not read ' .
$len . ' bytes from buffer.',
TTransportException::UNKNOWN);
}
if (TStringFuncFactory::create()->strlen($this->buf_) <= $len) {
if ($bufLength <= $len) {
$ret = $this->buf_;
$this->buf_ = '';
return $ret;