From: Jake Farrell Date: Tue, 25 Sep 2012 18:58:27 +0000 (+0000) Subject: THRIFT-1521:patches for more Performance X-Git-Tag: 0.9.1~304 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=78a54a17f148c17e5c0e9717f2e869066a45130a;p=common%2Fthrift.git 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 --- diff --git a/lib/php/lib/Thrift/Transport/TMemoryBuffer.php b/lib/php/lib/Thrift/Transport/TMemoryBuffer.php index cfe5e0ec..911fab64 100644 --- a/lib/php/lib/Thrift/Transport/TMemoryBuffer.php +++ b/lib/php/lib/Thrift/Transport/TMemoryBuffer.php @@ -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;